Re: Bug #10411 Updated: number_format returns wrong values
| From: | Mark Guertin | Date: | Fri, 20 Apr 2001 14:25:26 +0000 |
| Subject: | Re: Bug #10411 Updated: number_format returns wrong values | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-52058@lists.php.net to get a copy of this message | ||
That was just a typo on my part entering the information. 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.
Mark
on 4/19/01 5:53 PM, Bug Database at php-dev@lists.php.net wrote:
> ID: 10411
> Updated by: joey
> Reported By: mark@artshouse.com
> Old-Status: Open
> Status: Closed
> Bug Type: Unknown/Other Function
> PHP Version: 4.0.4pl1
> Assigned To:
> Comments:
>
> 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.
>
> Previous Comments:
> ---------------------------------------------------------------------------
>
> [2001-04-19 17:35:01] mark@artshouse.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
>
>
>
>
> ---------------------------------------------------------------------------
>
>
>
> ATTENTION! Do NOT reply to this email!
> To reply, use the web interface found at
> http://bugs.php.net/?id=10411&edit=2
>
======================================
Mark Guertin, IT Manager
Artshouse Communications Inc.
345 Adelaide Street West, Main Floor
Toronto, ON, Canada M5V 1R5
Phone (416) 340-6284 x222
Fax - (416) 581-1252