- edited description
Varying difference between 1.0 and 1
This works:
((1 - ((i * 1.0) / 10)) / (1.0 - ((i * 1.0) / 10))) --> 1
This doesn't:
i * ((1 - ((i * 1.0) / 10)) / (1.0 - ((i * 1.0) / 10))) --> (i * (1.0 - 0.1 * i)) / (1.0 - 0.1 * i)
If 1.0 is changed to 1 in the latter, it works too:
i * ((1 - ((i * 1) / 10)) / (1 - ((i * 1) / 10))) --> i
Thus, 1 and 1.0 sometimes are treated the same, sometimes not.
Comments (5)
-
reporter -
reporter - edited description
- changed title to Varying difference between 1.0 and 1
-
reporter Or, it might be just a coincidence, as this equation:
(1 - ((1 - (i/10)) / (1 - (i/10)))) --> 1+(-1+i/10)/(1-i/10)
is not simplified to zero for both 1s and 1.0s.
-
repo owner I changed the behaviour a bit to be more like other CAS for these cases in commmit 26680c7
The 1 and 1.0 difference occurs, if sometimes the IExpr#isOne() method is used which gives true for both 1 and 1.0, and sometimes an #equals() compare was used which distinguishes between 1 and 1.0
-
repo owner - changed status to resolved
- Log in to comment