bug-glibc
[Top][All Lists]
Advanced

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

glibc modf() bug - affects php


From: Alan J. Wylie
Subject: glibc modf() bug - affects php
Date: Mon, 22 Sep 2003 18:41:02 +0100

modf() in glibc 2.3.2 works when compiled for P3, but breaks when
compiled for P4

I noticed it when running regression tests for a PHP application.

glibc "make check" finds this problem.

Should Rock Linux have the facility to do a "make check" for selected
packages?

gcc version 3.2.3
Rock Linux 2.0.0-rc2 subversion revision 1478

See the following previous references:

http://bugs.php.net/bug.php?id=24342
http://bugs.php.net/bug.php?id=23967
http://bugs.php.net/bug.php?id=22887

Thread starting at:
http://groups.google.com/groups?selm=pan.2002.12.22.14.50.18.939808%40t-online.de


---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<
#include <stdio.h>
#include <math.h>

int main()
{
 double x = 1.1;
 double y;
 double z;
 
 printf("Calling modf() for %f\n", x);

 z = modf(x,&y);
 printf("fractional part = %f\ninteger part = %f\n", z, y);

 return 0;
}
---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<

(P3 - OK)# ./modf 
Calling modf() for 1.100000
fractional part = 0.100000
integer part = 1.000000

(P4 - broken)# ./modf 
Calling modf() for 1.100000
fractional part = 1.100000
integer part = -0.000000

CFLAGS='-O2 -pipe -march=pentium4' ../glibc-2.3.2/configure 
--prefix=/var/tmp/glibc2.3.2-p4 --enable-add-ons=linuxthreads
make
make check

gcc -nostdlib -nostartfiles -o /usr/src/glibc-2.3.2-p4/math/test-double <snip>

GCONV_PATH=/usr/src/glibc-2.3.2-p4/iconvdata LC_ALL=C <snip> >
/usr/src/glibc-2.3.2-p4/math/test-double.out
make[2]: *** [/usr/src/glibc-2.3.2-p4/math/test-double.out] Error 1
make[2]: Leaving directory `/usr/src/glibc-2.3.2/math'
make[1]: *** [math/tests] Error 2
make[1]: Leaving directory `/usr/src/glibc-2.3.2'
make: *** [check] Error 2

# grep -v ": ok$" math/test-misc.out 
modf (4.29497e+09, ...) failed
fpclassify (DBL_MIN-epsilon+epsilon) failed: 3
DBL_MIN: mantissa0 differs:        0 vs        1
DBL_MIN: exponent differs:    1 vs    0
fpclassify (-DBL_MIN-epsilon+epsilon) failed: 3
-DBL_MIN: mantissa0 differs:        0 vs        1
-DBL_MIN: exponent differs:    1 vs    0
-DBL_MIN: negative differs: 1 vs 0
0.0625 down: mantissa0 differs:        0 vs        1
0.0625 down: exponent differs:  3fb vs    0
0.0625 up: mantissa0 differs:        0 vs        1
0.0625 up: exponent differs:  3fb vs    0
-0.0625 up: mantissa0 differs:        0 vs        1
-0.0625 up: exponent differs:  3fb vs    0
-0.0625 up: negative differs: 1 vs 0
-0.0625 down: mantissa0 differs:        0 vs        1
-0.0625 down: exponent differs:  3fb vs    0
-0.0625 down: negative differs: 1 vs 0
0.0 up: mantissa0 differs:        0 vs        1
0.0 down: mantissa0 differs:        0 vs        1
0.0 down: negative differs: 1 vs 0

-- 
Alan J. Wylie           Frogtrade, Halifax, UK      http://www.frogtrade.com/
address@hidden

-- 
Alan J. Wylie                            http://www.glaramara.freeserve.co.uk/
"Perfection [in design] is achieved not when there is nothing left to add,
but rather when there is nothing left to take away."
  -- Antoine de Saint-Exupery




reply via email to

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