On Thu, Jun 26, 2008 at 12:45:39PM -0400, Mark J. Reed wrote:
: Moritz Lenz> 3.14 would be a Rat or a Float or whatever
: 
: That's a good question, actually.  Does the literal "3.14" get turned
: into a Float or a Rat?  Float is probably simplest, and matches what
: e.g. Lisp does, but you could argue either way.  Especially since many
: exact decimal literals become approximations in binary...

The internal representation of Num is opaque, and Num is allowed to
keep some subset of its values in Rat form internally and only convert
to floating point lazily when some operation is performed that makes
more sense in floating point than in rationals.  For some applications
you might like to pragmatically enforce that Nums stay in Rat format
to some particular fractional value, such as when calculating in
fractional currency.

The num type, on the other hand, is purely floating-point.

We could go as far as to guarantee that Nums do rational arithmetic
out to a certain point, but probably what the financial insitutions
want is special fixed-point types that assume a divisor anyway.
Would any financial institution care to comment?

Larry

Reply via email to