# SetPrecision

Posted 10 years ago
4032 Views
|
5 Replies
|
3 Total Likes
|
 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 :=                                   36interface(displayprecision)                                  211.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 ?
5 Replies
Sort By:
Posted 10 years ago
 Thank u Ivan Morozov  and thank u Isaac Abraham.Moses
Posted 10 years ago
 THis is perhaps 1 way to get a correct answer:In[27]    N[1.000000000000000000000 + 1.41959560000000000/10^11, 100]Out[27]  1.000000000014195956000
Posted 10 years ago
 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 *)
Posted 10 years ago
 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 precisiona = SetAccuracy[130, 30];b = SetAccuracy[1.4195956000`30*10^(-11), 30];a + bI.M.
Posted 10 years ago
 Using a much higher precision does not help:In[17]  AccountingForm[SetPrecision[1.0000000000000000000000 + 1.4195956000*10^(-11), 96], 21]Out[17]//AcountingForm=1.00000000001419597773Incorrect.