>>>>> "PJ" == Pense, Joachim <[EMAIL PROTECTED]> writes:

  PJ> Ronald J Kimball wrote:
  >> > But then you still have the issue of marking the difference between 257
  >> > cents and 257.0 cents.
  >> 
  >> Of course.  But that's much better than marking the difference between
  PJ> 2.57
  >> dollars and 2.56999999999999984013 dollars, wouldn't you agree?

  PJ> I don't think it is the difference you want to mark in this case. :-)

  PJ> But, of course, you are right.

and you are talking about two separate but related issues. one is how
you store and calculate money values and the safest way is to use
integer math with the smallest monetary units you can use (you can calc
in .00001 cents if you need to). the other part is how to properly
printout a money value with properly handled precision and
formatting. given an integer storage of the right scaling, conversion
for printing is easy and then all you have to deal with is formatting.

if you want to get really nasty and dirty, develop a decimal math
library with controllable precision and scaling. :)

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to