I have found that the best way to work with currencies is to avoid using any
type of floating point math.

If you multiply your start amount by 100, then perform your calculations as
integers and then divide by 100 again at the end, it should work out OK...

(Heh, at least it has worked for me when doing tax calcs and stuff - who
know what you are doing?!?!?!?)

Mikey

"Paul Berg" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I am putting together an app that involves the adding together of rounded
> numbers and displaying in a currency format.
> The round() function is causing errors of 1 cent to appear after addition.
> Does anyone know of any routines that might assist?
>
> Thanks in advance...
> Paul
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to