I’m currently trying to teach Bohrium that a+1+1
is the same as a+2
.
This was an somewhat easy task.
What were really doing is merging chains of Bohrium byte-code, whenever possible, say in the following Python program:
Here we should be able to combine all the additions and subtractions and simply add 10 to z
.
The same should be possible in the following:
This should be just multiplying with 5, however Python gives the following result, when running the above:
This is of course because of the order of operations, even though they do not matter in this case, and the fact that my z
array may only hold integers.
When the left-side can only hold integers, the following is unfortunately true:
\[\frac{\frac{z \cdot 5}{1} \cdot 2}{2} \not= \frac{\frac{r \cdot 5}{1} \cdot 2}{2} for\ z \in \mathbb{Z},\ r \in \mathbb{R}\ and\ z \equiv r\]