2 points on language. Continuing

Carl R. Witty cwitty@newtonlabs.com
24 Aug 2001 11:13:31 -0700


"D. Tweed" <tweed@cs.bris.ac.uk> writes:

> On a purely pragmatic note ( :-) ) these optimisations can't necessarily
> be safely used in three of the four most common cases, namely Int, Float
> and Double because of the restricted range of intermediates.

While the programmer can't necessarily change ((p-q)+p) to (2*p-q) in
the case of Int, the compiler usually can.  The compiler can know that
on the target machine, Int operations wrap on overflow in the typical
way, in which case that's an entirely safe optimization.

By the way, are there any Haskell systems where Int does not wrap on
overflow?

Carl Witty