On Wed, Jun 14, 2006 at 12:50:54PM +1000, justin randell wrote:
> question: why use float and not int?

Because we were dealing with money.  Discussions as to why floating point
numbers and money do not mix will be left to a later time -- I'm trying to
keep the set of concepts learnt in one hit manageable.

> #! /usr/bin/php
> <?php
> print round((float) $argv[1] / 5) * 5 . "\n";
> ?>
> 
> [EMAIL PROTECTED]:~/$ ./round5short.php 7.4
> 5

Wrong answer.  Should be 10.  Note that the rounding methodology considers
any remainder > 2 to be worth bringing up to 5.

- Matt

-- 
A polar bear is a rectangular bear after a coordinate transform.
_______________________________________________
coders mailing list
coders@slug.org.au
http://lists.slug.org.au/listinfo/coders

Reply via email to