Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 13734
Product:  
Component:  
Status: RESOLVED
Resolution: INVALID
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: W Unruh <unruh@physics.ubc.ca>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 13734 depends on: Show dependency tree
Show dependency graph
Bug 13734 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2004-01-19 04:17
The round() function outputs random numbers

#include <math.h>
main()
{
printf( "%f %f\n", round(1.0), round(1.0001));
}

Output
-2.000000 6.000000

However these values appear to be random, and can change on different 
machines and at different times on the same machine.

(Mandrake 9.0 and 9.1)
gcc -o test test.c -lm

------- Comment #1 From Andrew Pinski 2004-01-19 04:26 -------
Use warnings:
pr13734.c:4: warning: return type defaults to `int'
pr13734.c: In function `main':
pr13734.c:5: warning: implicit declaration of function `round'
pr13734.c:5: warning: double format, different type arg (arg 2)
pr13734.c:5: warning: double format, different type arg (arg 3)
pr13734.c:6: warning: control reaches end of non-void function

See how round is implicitly declared, use -std=c99 or -std=gnu99 which turns on the c99 
functions in math.h.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug