# The precision of the number

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?

-
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? –  rasher Mar 21 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 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 at 16:32
Considering Mr.Wizard's answer, I don't think this question should be closed. –  Michael E2 Mar 22 at 1:35

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$.

-
@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 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]

False

1880.64


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 @ %

True

1.

MachinePrecision

-