On Dec 3, 2007 3:29 PM, tedd <[EMAIL PROTECTED]> wrote:
> At 2:04 PM -0500 12/3/07, Andrew Ballard wrote:
> >
> >Oh, man I'm having flashbacks to a flame war that broke out on a
> >SQL Server board I read related to "bankers rounding" versus
> >"traditional rounding" and which was more "correct
At 2:04 PM -0500 12/3/07, Andrew Ballard wrote:
Oh, man I'm having flashbacks to a flame war that broke out on a
SQL Server board I read related to "bankers rounding" versus
"traditional rounding" and which was more "correct" or "accurate".
:-)
Andrew
There really shouldn't be a debate on
On Dec 1, 2007 11:30 AM, tedd <[EMAIL PROTECTED]> wrote:
> At 7:10 AM -0500 12/1/07, Christoph Boget wrote:
> >Why does
> >
> >sprintf( '%.03f', 0.1525 )
> >
> >return 0.152 while
> >
> >sprintf( '%.03f', 0.1575 )
> >
> >return 0.158?
> >
> >The 4th significant digit in both cases is '5' bu
2007/12/1, Christoph Boget <[EMAIL PROTECTED]>:
>
> Why does
>
> sprintf( '%.03f', 0.1525 )
>
> return 0.152 while
>
> sprintf( '%.03f', 0.1575 )
>
> return 0.158?
>
Welcome to the world of f floating point numbers. Discrete mathematics,
leave all hope, ye that enter.
It's the way fl
At 6:08 AM -0500 12/2/07, Christoph wrote:
If the general rule is to round up for 5s when preceeding is odd
and round down when even, that's not occuring here when using
round().
No, you're not reading what I wrote. I said MY general rule is to
round up when the preceding digit is even, wher
The 4th significant digit in both cases is '5' but in the first case, it's
rounded down but in the second case it is rounded up. Is sprintf() basing
it's decision on the value of the 3rd significant digit? If so, why?
Shouldn't rounding decisions be based on subsequent digits and not
preceding
At 7:10 AM -0500 12/1/07, Christoph Boget wrote:
Why does
sprintf( '%.03f', 0.1525 )
return 0.152 while
sprintf( '%.03f', 0.1575 )
return 0.158?
The 4th significant digit in both cases is '5' but in the first case, it's
rounded down but in the second case it is rounded up. Is sprint
Jochem Maas wrote:
> Per Jessen wrote:
>> Christoph Boget wrote:
>>
>>> Why does
>>>
>>> sprintf( '%.03f', 0.1525 )
>>> return 0.152 while
>>> sprintf( '%.03f', 0.1575 )
>>> return 0.158?
>
> most likely it's an artifact of the fact that
> the binary representations of those floating poi
Per Jessen wrote:
> Christoph Boget wrote:
>
>> Why does
>>
>> sprintf( '%.03f', 0.1525 )
>> return 0.152 while
>> sprintf( '%.03f', 0.1575 )
>> return 0.158?
most likely it's an artifact of the fact that
the binary representations of those floating point
values are not exact e.g. 0.1575
Christoph Boget wrote:
> Why does
>
> sprintf( '%.03f', 0.1525 )
> return 0.152 while
> sprintf( '%.03f', 0.1575 )
> return 0.158?
>
> I am using PHP 4.3.11
I see the same behaviour in 5.2.4
/Per Jessen, Zürich
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
10 matches
Mail list logo