At 11:47 AM -0700 8/24/04, Sean O'Rourke wrote:
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

Yes.

    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.

I'm still not sure about doing dynamic down-typing (or whatever it's called) to get the tighest possible type. I'm getting the distinct feeling that it's what most people want, though. :)
--
Dan


--------------------------------------it's like this-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to