Welcome Guest!
 EUforum
 Previous Message All Messages Next Message 
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
	
 Previous Message All Messages Next Message 
  Check It Out!

  Topica Channels
 Best of Topica
 Art & Design
 Books, Movies & TV
 Developers
 Food & Drink
 Health & Fitness
 Internet
 Music
 News & Information
 Personal Finance
 Personal Technology
 Small Business
 Software
 Sports
 Travel & Leisure
 Women & Family

  Start Your Own List!
Email lists are great for debating issues or publishing your views.
Start a List Today!

© 2001 Topica Inc. TFMB
Concerned about privacy? Topica is TrustE certified.
See our Privacy Policy.