SetPrecision

With MATHEMATICA 9:

“In[12] AccountingForm[SetPrecision[1.0000000000000000000000+1.4195956000×10^(-11),30],21]
Out[12] 1.00000000001419597773 "

This is an incorrect answer.

However, when I use MAPLE 13, I get a correct answer:
" Digits :=
                                  36
interface(displayprecision)
                                  21
1.0000000000000000000000+1.4195956000×10^(-11)
1.000000000014195956000 "

This is a correct answer.
Why is it so easy to get a correct answer on an older version of MAPLE 13 but not on MATHEMATICA 9 ?

Using a much higher precision does not help:

In[17] AccountingForm[SetPrecision[1.0000000000000000000000 + 1.4195956000*10^(-11), 96], 21]

Out[17]//AcountingForm=
1.00000000001419597773

Incorrect.

Hi,

you do plus for 1.0000000000000000000000 + 1.4195956000*10^(-11) with MachinePrecision, that’s the problem.

Accuracy[1.0000000000000000000000 + 1.4195956000*10^(-11)]

You shoud set both accuracy and precision

a = SetAccuracy[1``30, 30];
b = SetAccuracy[1.4195956000``30*10^(-11), 30];
a + b

I.M.

As Ivan has pointed out, anything entered with a decimal number in Mathematica is already at machine precision. Therefore, an alternative is to enter the numbers with infinite precision, and then ask for a specific “SetPrecision”.

(* iabraham, Mathematica 7.0.1.0, Win-7-64b *)
Clear["Global`*"]

a = 1; (* This enters the "1" with infinite precision. *)
b = 14195956*10^-18; (* The infinitesimal part is also at infinite precision. This is easily checked. *)
sum = SetPrecision[ (a+b), 22] (* Returns the expected answer. *)
Precision[sum] (* Returns 20 *)

THis is perhaps 1 way to get a correct answer:

In[27] N[1.000000000000000000000 + 1.41959560000000000/10^11, 100]
Out[27] 1.000000000014195956000

Thank u Ivan Morozov and thank u Isaac Abraham.
Moses