bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trunc and Round in GLIBC


From: Dhiraj Sharma
Subject: Trunc and Round in GLIBC
Date: Tue, 24 Sep 2002 17:07:37 -0400

I am running into anomalous behavior of trunc() and round() on Red Hat 7.3 (no changes made from my side at all) running on an Intel Pentium CPU. The following program gives me two numbers, both 0.
 
#include <stdio.h>
#include <math.h>
int main() {
   printf("%f\n", trunc(2.1);
   printf("%f\n", round(2.1);
}
 
If I use truncf and roundf, I get some random numbers. Other functions, such as, rint, floor, ceil give expected results.
 
If I am doing something wrong, it is totally unknown to me. I would appreciate help in this regard. Thank you very much in advance.
 
Regards,
Dhiraj Sharma
 
____________________________
Dhiraj Sharma
address@hidden
Tel:  908-647-3273
Fax: 908-647-2382
____________________________

reply via email to

[Prev in Thread] Current Thread [Next in Thread]