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

Re: glibc: floor() is giving incorrect results on alpha architecture



On Sat, Oct 06, 2007 at 10:15:28AM +0400, Alexander Kotelnikov wrote:
> Hi.
> 
> 0:14 pts/10 sacha@vinci:/tmp 5> cat dblc.c 
> #include <assert.h>
> #include <float.h>
> #include <math.h>
> #include <stdio.h>
> 
> int main() {
>   double x;
> 
>   printf("%s%d\n", "DBL_MANT_DIG = ", DBL_MANT_DIG);
>   x = ldexp (1.0, DBL_MANT_DIG) - 1.0;
>   printf("%lf %lf\n", x, floor(x));
>   assert(x == floor(x));    /* does not seem to work in alpha */
>   return 0;
> }
> 10:14 pts/10 sacha@vinci:/tmp 6> gcc -Wall -lm -o dblc dblc.c 
> 10:14 pts/10 sacha@vinci:/tmp 7> ./dblc 
> DBL_MANT_DIG = 53
> 9007199254740991.000000 9007199254740991.000000
> 10:14 pts/10 sacha@vinci:/tmp 8> uname -a
> Linux vinci 2.6.23-rc8-rt2x00-gc31d1777-dirty #1 Wed Oct 3 11:44:23 MSD 2007 alpha GNU/Linux

Does the kernel have MATH_EMU enabled or not?  What cpu generation?
Which libm version (libc6 package)?

--
Len Sorensen



Reply to: