|ANSI portable overflow detection davids@ICSI.Berkeley.EDU (1994-05-12)|
|Re: ANSI portable overflow detection email@example.com (1994-05-13)|
|Re: ANSI portable overflow detection firstname.lastname@example.org (1994-05-13)|
|Re: ANSI portable overflow detection Roger@natron.demon.co.uk (1994-05-18)|
|From:||Roger@natron.demon.co.uk (Roger Barnett)|
|Date:||Wed, 18 May 1994 00:23:59 GMT|
A "pragmatists" approach to overflow is built into the RTL/2 language
which was developed at ICI (Imperial Chemical Industries) in the early
1970s. Here the requirement was to reduce the chance of errors due to
unnecessary overflows during expression evaluation rather than a 100%
detection of every case, so the language defines a set of transitory
double-length types which are used to hold any intermediate results in
expressions involving multiplication/division/arithmetic shift operations
on fixed point operands.
So, for example, in:
I := J * K :/ L; % all integers, :/ is integer divide operator %
or F := G * H // K; % all fractions, // is fraction divide %
there is no loss of information.
(fraction is a fixed point type interpreted as having its binary point
immediately after the sign bit, so the fraction range is -1 <= f < 1)
Obviously the efficiency with which this can be implemented varies with
the level of support from the underlying hardware architecture.
FWIW, one of the main designers of RTL/2 - John Barnes - went on to
bigger things with his work on Ada.
Return to the
Search the comp.compilers archives again.