I want to imitate machine-precision, de facto IEEE division on Mathematica. On my quick trials I find this surprisingly hard to accomplish, since Mma rewrites a / b
as a (b^-1)
and these are not identical on finite-precision math.
For an explicit example, consider the following:
49. / 49. // FullForm
0.9999999999999999`
EDIT: As @J.M. points out, this works:
Divide[49., 49.] // FullForm
1.`
... but if I do the following, for instance, the finite-precision multiplication by inverse is seen again:
Divide[x, 49.] // FullForm
Times[0.02040816326530612`, x]
... which is bad.
How would I implement a "use native (IEEE) division semantics on machine-precision arguments of this division, even later down the evaluation chain" operation instead of Mma being too clever for its' own sake?
EDIT: In this specific case I'm not interested in other IEEE semantics, for instance strict order of operations (a + b + c
is not the same as c + b + a
!). I just want divisions to stay as divisions, which may be a bit of a half-way goal, but sounds more feasible to implement that the whole shebang.
Divide[49., 49.]
? (I think this was discussed before.) $\endgroup$a (b^-1)
expansion very eagerly... $\endgroup$