[Prev][Next][Index][Thread]

Re: Currency and Dylan



On Fri, 13 Oct 2000 23:30:02 -0400 (EDT), "Scott McKay" <swm@mediaone.net>
wrote:

> 
> Chris Double wrote in message ...
> >What approaches do people use for dealing with dollar values in Dylan?
> >In particular, making the dollar/cents add up
> >correctly. <double-float>? <integer>? A special currency class?
> >Reading/writing the dollar valuse to/from files as well. How do I do
> >this with floats for example?
> 
> 
> Definitely used scale integers.  If you've got dollars and cents,
> you'll probably want to scale by 3 or even 4 powers of ten.
> (BTW, I'm assuming you might want taxation, which is why
> scaling by 2 powers of ten isn't enough.)
> 

I agree. FTR CORBA's IDL defines a 'fixed' datatype for fixed point (scaled
integer) arithmetic that I presume is meant to be used for currency
calculations. So that's the kind of representation that I'd look at.

__Jason


References: