From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Charter B1) Description of problem: The round() function (and other similar rounding functions) do not work. (I included math.h) The following gives me a zero result: double dnum=10.00; dnum=round(dnum); /* dnum would be 0*/ Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1.Program above with or without optimization 2. 3. Actual Results: When using round I get 0, huge numbers or NAN Additional info:
round(3) is only part of ISO C99, so you need to select that feature set or language standard when compiling, like: gcc -std=c99 round.c -lm gcc -D_ISOC99_SOURCE round.c -lm gcc -D_GNU_SOURCE round.c -lm If you compiled the program with -Wall (and without one of the above options), you'd see what's going on clearly: warning: implicit declaration of function `round' See info libc, "Feature Test Macros" chapter.
Thanks, that worked. Without it, it was stomping all over memory. Will use the -Wall feature from now on.