Ah, yes. I actually wrote a SafeMath class some years ago and worked through all these,
testing carefully. But obviously I don't remember the results as well as I should.
(And can't find the class on my computers; oh well.) That trick I used works well with multiplication and division, but not addition and subtraction. All, right, try this:
The condition can be written more compactly, but I've tried to arrange it for maximum efficiency.
[ October 08, 2007: Message edited by: Jim Yingst ]