5
$\begingroup$

I was looking in Mathematicas documentation and could not find to which point Mathematica includes the IEEE 754 standard?

It is mention it in its documentation MachinePrecision under Background & Context:

floating-point computation and is most commonly implemented using the IEEE Standard for Floating-Point Arithmetic (IEEE 754) standard

and has an entry in Mathworld IEEE 754-2008:

As of 2014, the IEEE 754-2008 is the most commonly implemented standard for floating-point arithmetic. This framework is a massive overhaul of its predecessor IEEE 754-1985 and includes a built-in collection of guidelines specifying nearly every conceivable aspect of floating-point theory.

Of course Mathematica is aware of the standard, but I could not find a single passage where they explicitly mentioned the implementation of the IEEE 754?


P.S. I am using Mathematica for the unit testing of a C++ program and feel want to be sure I can reproduce the same results within both programs.

$\endgroup$
2
  • 1
    $\begingroup$ Also worthwhile mentioning is that specifying WorkingPrecision -> $MachinePrecision just gives the same precision as IEEE754 doubles but is still computed with an arbitrary precision number implementation while WorkingPrecision -> MachinePrecision actually uses hardware machine precision numbers, which makes it usually much faster but also inherits all the quirks from IEEE 754. $\endgroup$ Commented Dec 11, 2017 at 16:46
  • $\begingroup$ Machine precision and IEEE 754 is discussed in the documentation for MachinePrecision, 3rd para. under "Background and Context." $MachinePrecision is just a constant, "[typically] 53Log[10,2]," the precision of the binary64 floating-point format. $\endgroup$
    – Michael E2
    Commented Dec 11, 2017 at 17:46

1 Answer 1

4
$\begingroup$

Mathematica doesn't implement IEEE 754. Machine numbers use the native arithmetic of the hardware, which is usually IEEE 754. For approximate numbers of arbitrary precision, Mathematica uses its own arithmetic, not IEEE 754. Numbers with precision $MachinePrecision are not necessarily machine numbers: they may have arbitrary precision that happens to match $MachinePrecision.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.