Trying to make work FPDF, a php class for the generation of PDFs, I found several problems. Finally with help of Olivier Plathey (the author of FPDF) we found this bug related to Gentoo: http://bugs.php.net/bug.php?id=21658 As it is said in that web, this php code: for($t=0;$t<10;$t++) { $r=(float) rand(0,10000)/3; echo $r." -> ".sprintf('%.3f',$r)."\n"; } will produce ... 1975.33333333 ->
Trying to make work FPDF, a php class for the generation of PDFs, I found several problems. Finally with help of Olivier Plathey (the author of FPDF) we found this bug related to Gentoo: http://bugs.php.net/bug.php?id=21658 As it is said in that web, this php code: for($t=0;$t<10;$t++) { $r=(float) rand(0,10000)/3; echo $r." -> ".sprintf('%.3f',$r)."\n"; } will produce ... 1975.33333333 -> ç.000 508.333333333 -> ,.000 2483.66666667 -> ã.000 61.6666666667 -> m.000 2514.66666667 -> I00.000 2499.66666667 -> *0.000 1957.33333333 -> ü0000.000 3167.33333333 -> 0.é00 655.666666667 -> 600.000 3321.66666667 -> ).000 2256.33333333 -> 0.S00 383.666666667 -> 0.,00 1565.33333333 -> M.000 I suppose there's something wrong with glibc 2.3.1-r2. The solution of that bug in the page I have mentioned was: "The strange behaviour was related to a strange combination of gcc and glibc. Nothing was usefull (gcc and glibc recompilation). I had to compile gcc and glibc on another machine, copy binaries of gentoo emerge binary option system and all now is working fine. It was a library problem." Information about my system: Portage 2.0.47-r10 (default-x86-1.4, gcc-3.2.2, glibc-2.3.1-r2) ================================================================= System uname: 2.4.20 i686 Intel(R) Pentium(R) 4 CPU 2.00GHz GENTOO_MIRRORS="ftp://ftp.etse.urv.es/pub/linux/gentoo http://gentoo.oregonstate .edu/ http://www.ibiblio.org/pub/Linux/distributions/gentoo" CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config /usr/kde/2/share/confi g /usr/kde/3/share/config" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" PORTDIR="/usr/portage" DISTDIR="/usr/portage/distfiles" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR_OVERLAY="/usr/local/portage" USE="x86 oss apm crypt gif jpeg libg++ mmx mpeg ncurses nls oggvorbis pdflib png xml2 zlib gdbm berkdb slang readline gpm tcpd pam libwww ssl perl python -3dnow acpi -arts -avi -cups -encode flash -gnome -gtk -imlib -java -kde -mikmod -moti f mysql -opengl -qt -qtmt -quicktime -sdl -spell -svga -truetype -X -xmms -xv im ap" COMPILER="gcc3" CHOST="i686-pc-linux-gnu" CFLAGS="-march=pentium4 -O3 -fforce-addr -fomit-frame-pointer -funroll-loops -fr erun-cse-after-loop -frerun-loop-opt -falign-functions=4" CXXFLAGS="-O2 -mcpu=i686 -pipe" ACCEPT_KEYWORDS="x86" MAKEOPTS="-j2" AUTOCLEAN="yes" SYNC="rsync://rsync1.es.gentoo.org/gentoo-portage" FEATURES="sandbox ccache" mod_php 4.3.1 Apache 1.3.27-r3 glibc 2.3.1-r2 gcc 3.2.2 Any ideas?
Look at Bug #18435, had the same problem. I resoved it with changing the cflags to pentium3 and recompile glibc.
pentium4 FP math is BROKEN under glibc-2.3.1/2. It's an upstream bug. Recompile with -march=pentium3/-mcpu=pentium3 and avoid pentium4. Athlon4 has the same problem ATM.
closing as it was the old pentium4 glibc bug.