0
$\begingroup$

Suppose we have run a calculation and get a number like

2.758952615889003`

If we then copy-paste this number and do a calculation like

2.758952615889003`-1

Mathematica will give a red 0. and an error about no significant digits. Why does this happen (note:putting a "`" on the 1 fixes the problem, so perhaps I am mixing different types of numbers?)

Even more worrisome to me, is that perhaps my calculations in some long program will be messed up from such an issue.

Is there a global setting that I can change (for example, at the top of a document or something), so that mathematica can properly do such calculations (with some "acceptable" amount of error?


I realize that if I instead do

N[2.758952615889003]`-1

Mathematica will do the calculation. I also realize that this is an issue with precision.

However, I have tried reading the documentation and some questions on this site, and I don't understand either 1) What the issue is, 2) Whether I can globally set precision so that such calculations work out with some acceptable amount of error.

For example, I believe using N as above, means mathematica uses machine precision. Is this machine precision good though? Or bad? I tried reading through the documentation and I can't figure it out.

I realize that there are questions about this on the site, and that mathematica has documentation on this, but honestly I cannot understand it well. So here I am specifically looking for if someone can explain how I can deal with this, in a more simple manner

Edit: One more thing. The help documentation here makes me think arbitrary precision numbers are better (since it talks about arbitrary precision numbers maintaining a pertaining number of correct digits, and machine precision numbers needed to be checked for correctness). If that is the case though, how come arbitrary precision numbers don't work in the simple example, but using N for machine precision does?

$\endgroup$
3
  • 3
    $\begingroup$ One way to avoid this kind of problem is to assign the number to a symbol when doing the calculation, say x=2.758952615889003. Then you can operate on x without worry. Alterantively, you can put a space between the number and the minus sign. 2.758952615889003 -1 works fine while 2.758952615889003`-1 (without the space) does not. $\endgroup$ – bill s Apr 5 at 21:12
  • 4
    $\begingroup$ An integer after a number mark indicates the number of digits of precision. Without a space you are asking for -1 digits of precision. This results in a red zero with a tooltip stating that "No significant digits are available to display." Similarly, Precision[2.758952615889003`-1] evaluates to 0 digits of precision with a warning of Precision::precsm: Requested precision -1. is smaller than $MinPrecision. Using $MinPrecision instead. $\endgroup$ – Bob Hanlon Apr 5 at 21:27
  • $\begingroup$ Also note that 2.758952615889003` is not an arbitrary-precision number. Evaluating Precision[2.758952615889003`] will show that it is a machine precision number. Either 2.758952615889003`15 or SetPrecision[2.758952615889003`, 15] are arbitrary-precision numbers with 15 digits of precision. $\endgroup$ – Bob Hanlon Apr 5 at 21:38

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.