>>>>> "SHC" == Shawn H Corey <shawnhco...@gmail.com> writes:

  SHC> Uri Guttman wrote:
  >> the correct solution for money has always been to use integers
  >> for the smallest amount (e.g. cents). this will always be correct in all
  >> languanges.
  >> 

  SHC> Sorry, but sometimes you have to use real numbers.  On the news,
  SHC> exchange rates are given to a thousand of a cent, which is OK most
  SHC> most people.  But when you exchange 1_000_000 dollars at a time, like
  SHC> some big banks, an exchange could be out by as much as $10.  So you're
  SHC> back to the two questions:

  SHC> * What accuracy does the application need?

so use integers for 1/1000 of a cent. i said the smallest amount
needed. you can go even lower. with 64 bit ints you can go to a
millionth of a cent and still have massive amounts (40 bits or so) of
dollars. 

  SHC> * Does the program meet this accuracy?

not the program but the method of encoding, computing and printing
money.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to