[PHP] Re: currency rounding issues

2002-06-05 Thread Manuel Lemos
Hello, On 06/05/2002 09:55 PM, Paul Berg wrote: 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

[PHP] Re: currency rounding issues

2002-06-05 Thread Michael Davey
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

Re: [PHP] Re: currency rounding issues

2002-06-05 Thread Bogdan Stancescu
As a side note, your final question does make sense - I was surprised (dunno why, but I was) to find there are things which cost less then 1c, some even less than 1/10 c, so... Bogdan Michael Davey wrote: I have found that the best way to work with currencies is to avoid using any type of