On Sun, Nov 24, 2002 at 10:33:23PM +0100, Florian Weimer wrote: > Dan Sugalski <[EMAIL PROTECTED]> writes: > > > .NET has exception-throwing versions of its math operations. If you do > > an add of two 8-bit integers and the result overflows, you should get > > an exception (if you've used the "check overflow" versions of the ops) > > Actually, I thought about implementing Ada. The standard requires the > following: > > 20. For a signed integer type, the exception Constraint_Error is > raised by the execution of an operation that cannot deliver the > correct result because it is outside the base range of the type. > > And this is painfully to implement if the machine doesn't support it > (e.g. by overflow flags or trapping arithmetic).
For integer maths if the machine uses 2s complement arithmetic I believe it's not that painful. (And even if it doesn't it's not hugely painful) [ie I think I know how to do it] Floating point fills me with fear. Nicholas Clark -- Befunge better than perl? http://www.perl.org/advocacy/spoofathon/