Dissipative Arithmetic |
Computer arithmetic is not reversible. In the sense that give the output of an arithmetic expression, it is (in general) impossible to infer its inputs. E.g. a = x + y
If a = 4.0, then x may be 2.0 and y also 2.0 or x may be 1.1 and y 2.9, or x=0.499999 and y=3.5, etc., etc.
Note a change might be visible from a mathematically pure point of view but here we say it is not visible, if when we test it the new arithmetic expression gives the same value as the earlier version. Often, if we spend more effort testing, then the change is more visible, e.g. in the sense that that more tests show a difference. However testing resources are always finite.
Experiments show small syntax changes can be totally lost in large rational functions composed of the four common arithmetic operators addition (ADD), subtraction (SUB), multiply (MUL) and division (DIV). Notice that all four functions are binary, i.e. they take exactly two arguments.
In floating point arithmetic, division by zero leads to infinity and other non-finite values. These propagate immediately through the whole expression often giving a non-finite answer. In such expressions almost any change will be undetectable as the result will still be infinity (or not a number, nan).
To keep arithmetic finite, we protect division by defining divide by zero to give 1.0 i.e. (DIV x 0.0) = 1.0
In more complicated expression, we have to use brackets to force the order in which the arithmetic is applied. E.g. (x + 0.997) * -0.052 can be thought of as (MUL (ADD x 0.997) -0.052)
Which in turn can be displayed as a tree:
Animation of both old (blue) and new function (red)
each frame at a different blue node in
Figure 2.
Notice how new functionality quickly overlaps old
hiding more and more of it.
Crosses + show test cases where they agree exactly.
Eventually, after 92 moves up the expression tree,
they agree exactly on all test cases
and the syntax change cannot be seen.
Click for high resolution version
[1]
Fast Generation of Big Random Binary Trees for genetic programming.
RAND_TREE2_FASTER C++ code:
(or
rand_tree.cc_r1.43
part of GPquick).
See technical report
RN/20/01