
12 Jan
2011
12 Jan
'11
7:45 a.m.
Henning Thielemann
A code doing addition and substraction of some sort. A property such as "X = (X add Y) sub Y" is easily falsifiable when the number of bits of your integer is too small for your numbers.
Since fix-width words represent modulo-arithmetic, your law would even hold in case of overflows.
True in this very example, but it's overly simplistic and I chose it just for the sake of illustration. A property such as "X = (X mul Y) div Y", with Y != 0 (of course ;-), Y prime wrt 2^nbBits (nbBits being the size of your integers), and the intermediate product exceeding 2^nbBits would fail miserably... --Serge