ID: 22887
Updated by: [EMAIL PROTECTED]
Reported By: josh at chatgris dot com
Status: Open
Bug Type: Scripting Engine problem
Operating System: Gentoo Linux /w apache2
PHP Version: 4.3.1
New Comment:
This is most likely being caused by over-optimization when
compiling. I had a similar problem on my gentoo box, and
the problem was traced back to over-optimizing when
compiling glibc. (var_dump() was printing some weird
floats, and I believe this problem is similar, as both use
modf() at some point.)
Basically, tone down the optimizations a bit. If you
compile glibc with CFLAGS along the lines of
"-march=pentium4 -O3...", modf() starts dying. The
solution (for gentoo, at least) is to modify your USE flag
in make.conf to use -march=pentium3 if you're using
pentium4 and re-emerge glibc, then recompile PHP.
gcc has problems with march pentium4 spitting out bad
instructions, so you should stay away from it, even if
you're actually on a Pentium 4. Use march=pentium3 or
mcpu=i686 instead. There are threads on the gentoo forums
about this, and newer versions of portage mention it in
the make.conf comments.
If this is indeed the problem, it affects python, too,
fwiw.
J
Previous Comments:
------------------------------------------------------------------------
[2003-03-28 10:27:01] josh at chatgris dot com
I believe the problem is related.. For example, we are
both using Pentium$ CPU's..
sprintf works fine on my Athlon, but not my pentium4...
In addition, his example produced the same output on my
machine. and I've tried putting the float in a variable,
float as a string it alwasy returns the same so I am
pretty sure that the problem is within sprintf..
Could anyone tell me where the sprintf code is in php? I
don't mind messing with it and trying to figure out what
is wrong...
Josh.
------------------------------------------------------------------------
[2003-03-28 04:41:25] [EMAIL PROTECTED]
Works fine here (Gentoo with glibc 2.3.2), using php5 cvs from two days
ago (cli).
-tal
------------------------------------------------------------------------
[2003-03-28 02:43:18] [EMAIL PROTECTED]
Just tried PHP4.3.2/5 with CLI/Apache1 on mdk/winxp. All
work fine and the code that might cause the problems is not sapi
dependant.
The external message you pointed to is different because he used a
string to be printed with %f. That means it must first be converted to
a number and then printed.
------------------------------------------------------------------------
[2003-03-28 00:08:36] josh at chatgris dot com
I am not the only one experiencing this problem.. plus it
seems to round the number randomly for example
echo sprintf('%.2f', '8.7586206896551724');
returns 10.00
the person who had this problem's post is here
http://forums.gentoo.org/viewtopic.php?t=38470&highlight=sprintf
------------------------------------------------------------------------
[2003-03-27 21:55:28] [EMAIL PROTECTED]
It cannot be a general php problem as nobody here can reproduce it. It
has to something related to either Apache2 or some other factor unique
to your machine.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/22887
--
Edit this bug report at http://bugs.php.net/?id=22887&edit=1