|
Posted by David T. Ashley on 12/27/06 19:28
<kkmigas@gmail.com> wrote in message
news:1167146220.067133.35770@73g2000cwn.googlegroups.com...
> PHP code
> echo "round(10.045,2) - ".round(10.045,2)."<br />";
> echo "round(20.045,2) - ".round(20.045,2)."<br />";
> echo "round(30.045,2) - ".round(30.045,2)."<br />";
> echo "round(40.045,2) - ".round(40.045,2)."<br />";
>
> This is very strange:
>
> round(10.045,2) - 10.04
> round(20.045,2) - 20.05
> round(30.045,2) - 30.05
> round(40.045,2) - 40.05
Why are you posting this code and quoting my post?
..045 = 45/1000 = 9/200 = denominator not a power of 2.
Like your earlier examples, these numbers are not exactly expressable as
base-2 decimals.
It would be interesting to determine the breakpoint between
> round(10.045,2) - 10.04
> round(20.045,2) - 20.05
where the rounding changes. I'm going to guess that 15.045 is one way and
16.045 is the other.
Dav.e
Navigation:
[Reply to this message]
|