add round if not defined #70

wants to merge 1 commit into


None yet

3 participants


No description provided.

mruby member

On what platform round(3m) is not available?
Besides that, I don't think "#ifdef round" is a proper condition to detect.


It need to add "-std=c99" to gcc.
I may fix Makefile.

tkrdev5:~/tmp% cat r.c


int main()
printf("%f %f\n", round(0.3), round(1.3));

tkrdev5:~/tmp% gcc -v

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1.1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-cld --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.3.2 (Debian 4.3.2-1.1)

tkrdev5:~/tmp% rm a.out; gcc -Wall -Werror-implicit-function-declaration r.c

r.c: In function 'main':
r.c:6: error: implicit declaration of function 'round'
r.c:6: warning: incompatible implicit declaration of built-in function 'round'
r.c:7: warning: control reaches end of non-void function

tkrdev5:~/tmp% ./a.out
zsh: no such file or directory: ./a.out

tkrdev5:~/tmp% gcc -Wall -Werror-implicit-function-declaration -std=c99 r.c
tkrdev5:~/tmp% ./a.out
0.000000 1.000000


I wonder that the Makefile don't have -lm link option.

mruby member

tools/mrbc/Makefile and tools/mruby/Makefile has -lm specified.
Is this problem for you?


No. I didn't get a problem like this.

mruby member

we no longer use round(3) after de67c32.

@matz matz closed this May 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment