8

What is meant by a machine number in the Mathematica documentation? What is the difference between machine-precision and fixed-point precision? What is arbitrary precision?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574

1 Answers1

11

This is not an answer. But I don't believe we should close this question as "easily found in the documentation".

Numerics in Mathematica is an extremely complicated and mostly undocumented subject, where several mathematical concepts run up against each other in subtle and non-trivial ways. I have been thinking for some time that we ought to address this properly. Here is an outline for how I thought this could be approached.

There are three main headings, each containing enough material for several answers:

  1. The formalist's view: floating-point numbers as rationals

    • Decimal vs. binary digits
    • $MachineEpsilon
    • SetPrecision and Rationalize
    • IEEE issues: Infinity/Indeterminate vs. Inf/NaN; rounding modes; LAPACK vs. C definition of $MachineEpsilon
  2. Mathematica's view: floating-point numbers as distributions

    • The nature of the distribution: interval arithmetic versus Gaussian error propagation
    • $EqualTolerance; $SameQTolerance; Internal`CompareNumeric
    • Significance arithmetic and error propagation
  3. Practicalities: floating-point numbers as a model of the reals

    • Accuracy and Precision
    • $MinPrecision/$MaxPrecision
    • Dealing with numerically unstable functions
    • Adaptive-precision evaluation; $MaxExtraPrecision
    • "CatchMachineUnderflow" system option
    • PossibleZeroQ and associated system options "ZeroTestMaxPrecision" and "ZeroTestNumericalPrecision"

Anyone should feel free to add to these lists of topics in case I forgot anything. There are answers covering some of them already, but a lot of it is not widely known. I propose that, as a collaborative effort, we could address this question comprehensively (it's too much work for me to do by myself). This thread seems like a golden opportunity to do so.

Oleksandr R.
  • 23,023
  • 4
  • 87
  • 125
  • The challenge is to explain everything adequately without having to write an entire numerical analysis textbook… in any event, one will have to also consider whether a problem is due to an unstable algorithm or an ill-conditioned problem. – J. M.'s missing motivation Jun 19 '16 at 15:32
  • @OleksandrR. what does Internal`CompareNumeric do? – QuantumDot Sep 19 '16 at 01:32
  • 2
    @QuantumDot Internal\CompareNumeric[prec, a, b]returns -1, 0, or 1 according to whetherais less, equal, or greater thanbwhen compared at the precision ofaorb(whichever is less) minusprecdecimal digits of "tolerance". It is the fundamental operation underlyingLess,Equal,Greater,LessEqual` etc. for finite-precision numeric types. – Oleksandr R. Sep 19 '16 at 22:01