Heteroclinic.net logo

www.heteroclinic.net

Safe Integer Addition Analysis
20140629
For the addition of two integers a and b, we know how to safely predict an overflow instance. For two integers addition, the carry will be exactly 1, the remainder is a- (M - b + 1), for a >= b > 0; if b is 0, there won't be overflow.

Safe Integer Addition Coding Experiment
20140629
Experimenting safe addition:


Safe Integer Multiplication Analysis
20140629
Given M >= a >= b > 0, for b =0, no overflow will happen.


Safe Integer Multiplication Coding Experiment
20140629
Experimenting safe multiplication:


We found engineering is hard. It is not a soft target.
We also found how fatal the least significant digit(s) plays in deciding the prime or composite attribute of a very large number.