|
Re: Glitch in floor() function?
|
Kat
|
Jun 27, 2008 12:02 PDT
|
posted by: Kat <KAT12 at co?sahs?net>
Matt Lewis wrote:
| |
Mike Wever wrote:
| |
Thanks to everyone who replied on this. I thought it was due to something
like that but I couldn't see the difference in the value even going out to 20
decimal places.
So does anyone have a suggestion for a better way to handle rounding? I'm
trying to verify a sales tax computation and after using this rounding
routine, I had a situation where the result of round(62.50 * 0.075, 2) was not
equal to the number that resulted from value("6.49").
|
Don't use integer values for dollars. Easiest thing would be to use either
pennies or fraction of a penny to be your unit.
|
Or use one of the string math libs in the user contribs, since they can do base10 math and most have the range to handle 100's+ of digits.
Kat
|
|
 |
|