There are many ways to control precision in Mathematica, such as PrecisionGoal in specific build-in commmands or SetPrecision to some variables. I got two questions below,
(1) If I do not set any options for precision, in what precision will Mathematica calculates the numberical expression ? Single float or double float ? Or something else ?
(2) How can I set the precision globally ? Not only in the build-in functions, but all other expressions I write by my self.
A certain question might be more clear. In my program, I have to use the funtion Dot and MatrixExp or functions defined by myself. How can I control the precision both in the output and calculation process ?
It seems that such questions are easy to solve in Fortran or C......

  • 2
    $\begingroup$ If you don't specify precision at all, most functions will operate at either the precision of the input, or WorkingPrecision (whichever is less). Look up $MinPrecision and $MaxPrecision (which can be equal to each other). The lowest allowable precision is none and the maximum is infinity. And, remember that Mathematica can use adaptive precision for functions such as N or that have a PrecisionGoal option. $\endgroup$ – Oleksandr R. Dec 27 '14 at 17:40
  • $\begingroup$ MachinePrecision is the closest to a C floating point number. The name suggests it depends on your machine, but for most that means a 64-bit float, often called "double precision." There's only one flavor of machine precision. Then there's ArbitraryPrecisionCalculations which you can read about. There is nothing like it in basic C; it would have to be implemented through a library. $\endgroup$ – Michael E2 Dec 27 '14 at 20:36
  • $\begingroup$ Arbitrary precision is implemented using GMP, FWIW. $\endgroup$ – Oleksandr R. Dec 27 '14 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.