Reply to Re: ROUND

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация