ID:               10411
 Comment by:       yossi_shelli at cso dot co dot il
 Reported By:      mark at artshouse dot com
 Status:           Closed
 Bug Type:         Unknown/Other Function
 Operating System: Solaris 8, Slackware 7.0
 PHP Version:      4.0.4pl1
 New Comment:

I have the same problem here.
Running on windows 2000 , php version 4.3.7, Apache/2.0.49.

Tryed everything and every vriable with a number smaller then 1000
return a normal result. but a vriable with a number greater then 1000
return 1.00 as a result.

If i put a constant number instaed of vriable in the first parameter of
number_format (e.g. number_format (1099,2)) then the result will be ok.

My shop is also running on linux, tryed it on it, and the same results
:(

if anyone of u got answer to this problem, or a way to byepass it
please respond to this.

Yossi shelli


Previous Comments:
------------------------------------------------------------------------

[2001-04-20 15:14:01] mark at artshouse dot com

That was just a typo on my part entering the information 
here.  The bug still exists, and I think it specifically 
has to do with values set as float,2 from MySQL. It doesn't 
happen every time, but I have seen this on at least 5 
occasions now (in 5 different sets of code).

I can recreate it within my code, but you don't want me to 
paste my code (its all intermingled in a 600 lines of 
script)

check it out specifically using values pulled from MySQL 
with a type of float,2.

Here's the kicker, if I do something like 
$total=number_format($totals,2); print $total; the bug 
exists...if I do print number_format($totals,2) it works 
normally.

------------------------------------------------------------------------

[2001-04-19 17:53:57] [EMAIL PROTECTED]

Try changing:
$total = number_format($calcs_a + calcs_b,2);
to
$total = number_format($calcs_a + $calcs_b,2);
(Note the missing $)

Works just fine here with that small adjustment.

------------------------------------------------------------------------

[2001-04-19 17:35:01] mark at artshouse dot com

number_format returns wrong values in certain situations, 
here is a code example...

$value = 504;
$calcs_a = number_format($value,2);

$othervalue = 504;
$calcs_b = number_format($othervalue,2);

$total = number_format($calcs_a + calcs_b,2);

this returns:
$calcs_a is 504.00
$calcs_b is 504.00
$total is 1.00  (should be 1008.00)

I have seen this on several occasions now on multiple 
machines/setups/Oses




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=10411&edit=1

Reply via email to