Okay, as has been suggested, the type order for numbers should go:

   int->bignum->float

owing to the fact that floats are lossy and nasty. I'm not entirely sure I agree, given that floats are supported in hardware and faster (I've gotten a suggestion that we only do float and bignum for PMCs, since float ops are nearly as fast as int ops, and there are more bits, but the quiet loss of precision bothers me enough that I'm not sure I'm up for that) but it's a sensible argument.

To recap the rest of the behaviors, basic math operations (addition, subtraction, multiplication, division, and modulus) produce a result that's of a type no tighter than the loosest type in the operation (so int+bignum gets a bignum, but int+int will be an int if the result fits, or a bignum if it doesn't), and error operations (division by zero, overflow, or precision loss) throw an exception.
--
Dan


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

Reply via email to