At Tue, 24 Aug 2004 13:33:45 -0400,
Dan Sugalski wrote:
> 6) Division of two ints produces a bignum

Where "bignum" means both "bigger than 32-bit integer" and "rational
number"?  So

    4 / 2 ==> Bignum("2/1")

which doesn't get automatically downgraded to a normal int.  Ok.

> 7) Strings are treated as floats for math operations

I think we can do better than this by first converting a string to the
"least" reasonable numeric type (with int < float < bignum), then
re-dispatching to the appropriate numeric x numeric operation.  Always
treating strings as floats means we lose both when 2+3 != 2+"3" and
when one of the strings is too large to be a floating-point number.
Also, doing this redispatch means that the printed and internal
representations of numbers will always behave the same way.

/s

Reply via email to