Wed, 18 May 1994 00:23:59 GMT

Related articles |
---|

ANSI portable overflow detection davids@ICSI.Berkeley.EDU (1994-05-12) |

Re: ANSI portable overflow detection upton@quip.eecs.umich.edu (1994-05-13) |

Re: ANSI portable overflow detection hbaker@netcom.com (1994-05-13) |

Re: ANSI portable overflow detection Roger@natron.demon.co.uk (1994-05-18) |

Newsgroups: | comp.compilers |

From: | Roger@natron.demon.co.uk (Roger Barnett) |

Keywords: | arithmetic |

Organization: | Compilers Central |

References: | 94-05-039 |

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.

--

Roger Barnett

--

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.