Leo's been nudging me to get the behaviours of the basic types defined, so I'm working on updating PDD 17 with them.

The unary behavior of the types is reasonably straightforward. What I'm puzzling over right now is the binary behavior. It's the edge cases that are troublesome, of course -- what to do on overflow, and what to do with fractional results.

Fractions are an issue mainly with integer division -- in the case of int/int, should the result be an int, or a float of some sort?

Overflow's an issue to some extent with addition and subtraction, but moreso with multiplication. Should the result be promoted to a larger type (either unconditionally, or on overflow), which one, and what counts as overflow? (Is it exceeding the limits of the type, or losing precision?)

I'm up for some discussion on this one. I'm tempted to leave integer binary ops integers, binary ops with one or two floats a float, and binary ops with a bignum as a bignum and to heck with overflow, but I can see arguments for a more precise answer, as well as providing a way to specify whether you want accuracy or speed (potentially with or without throwing an exception where promotion'd otherwise take place and we don't). We could do them all, but... that seems more than a little excessive. Besides the MMD table entries, there'd be a lot of flag checking (or a *really* big set of MMD tables) which is sub-optimal.

This'd be a good time to make cases, folks!
--
                                Dan

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

Reply via email to