Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have problem in Mathematica with unnecessary rounding which is caused by high precision. For example I have value a = 2.052685846*10^-1865, when I make b = 1 - a the result is b == 1.
What can I do to have a better precision, without rounding?

share|improve this question
Works for me, but I'm on 9.0.1. Don't imagine any major differences here between versions - are your examples exactly what you're using? – ciao Mar 21 '14 at 9:04
@rasher Yes, it is EXACTLY the same. So as you can see, there must be a difference. Or maybe I can change seetings to have better precision? – Ziva Mar 21 '14 at 9:12
Are you sure you didn't write b = 1. - a? The decimal point after the 1 makes all the difference. – m_goldberg Mar 21 '14 at 16:32
Considering Mr.Wizard's answer, I don't think this question should be closed. – Michael E2 Mar 22 '14 at 1:35
up vote 2 down vote accepted

Works for me on Mathematica 8.0.
however, you can try using N to have the value number with the number of significant digits as you like:

b = N[ 1-a, 2000]

$2000$ digits after the decimal point in this case Mathematica does not perform rounding to $1$.

share|improve this answer
@Ziva N[ 1-a, 2000] yields the same result as 1 - a for me (V9.0.1, 8.0.4, 7.0.0). I don't get 2000 digitsl I get 1880 plus 27 insignificant digits. – Michael E2 Mar 22 '14 at 1:34

I suspect that there may be an issue of $MaxMachineNumber in play here. On my machine $MaxMachineNumber is 1.79769*10^308 therefore:

MachineNumberQ[a = 2.052685846*10^-1865]

Precision[1 - a]


This means that 1 - a is done with arbitrary precision arithmetic and all digits are displayed. However if a smaller exponent is used such that a is machine size only machine precision arithmetic will be used, and the result is 1.:

MachineNumberQ[a = 2.052685846*10^-186]  (* note -186 *)

1 - a

Precision @ %


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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