Re: 1 - 1, 1 -1, 1-1, 1 - -1 and -2147483648

"David R Tribble" <david@tribble.com>
3 Feb 2006 18:35:45 -0500

          From comp.compilers

Related articles
[5 earlier articles]
Re: 1 - 1, 1 -1, 1-1, 1 - -1 and -2147483648 gneuner2@comcast.net (George Neuner) (2006-01-31)
Re: 1 - 1, 1 -1, 1-1, 1 - -1 and -2147483648 rivers@dignus.com (Thomas David Rivers) (2006-01-31)
Re: 1 - 1, 1 -1, 1-1, 1 - -1 and -2147483648 david@tribble.com (David R Tribble) (2006-01-31)
Re: 1 - 1, 1 -1, 1-1, 1 - -1 and -2147483648 henry@spsystems.net (2006-01-31)
Re: 1 - 1, 1 -1, 1-1, 1 - -1 and -2147483648 gah@ugcs.caltech.edu (glen herrmannsfeldt) (2006-02-02)
Re: 1 - 1, 1 -1, 1-1, 1 - -1 and -2147483648 DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-02-02)
Re: 1 - 1, 1 -1, 1-1, 1 - -1 and -2147483648 david@tribble.com (David R Tribble) (2006-02-03)
| List of all articles for this month |

From: "David R Tribble" <david@tribble.com>
Newsgroups: comp.compilers
Date: 3 Feb 2006 18:35:45 -0500
Organization: http://groups.google.com
References: 06-01-13106-01-146
Keywords: arithmetic, lex
Posted-Date: 03 Feb 2006 18:35:45 EST

David R Tribble wrote:
> Another method is to convert all but the last digit into an integer,
> so that <2147483648> becomes <214748364, 8>. Then a simple
> range comparison can be made to determine if the token is too
> big for a valid integer value. This method avoids overflow.


Just to add a note...
There is a rule (I thought it was Horner's Rule, but that's not right),
which allows you to check whether adding a digit to a number will
result in overflow before doing the actual multiply and add of the
digit.


-drt


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.