Could anyone explain why the evaluation of this gives a weird error?

a = 1.11111111111111111111; Do[a = 2 a - a; a, 50] enter image description here

  • 1
    $\begingroup$ It's Precision[] and its loss due to subtractive cancellation. $\endgroup$
    – Michael E2
    Oct 5, 2020 at 0:43

1 Answer 1


In the calculation of the Precision[] of 2 a - a, the error in 2 a and a are treated as independent. Therefore the error bounds, 2 Δa and Δa, are added. Thus the new error bound is estimated as 3 Δa, and the Precision[] is reduced by Log10[3] each iteration. Therefore we run out of Precision[] in Precision[a]/Log10[3] steps:

a = 1.11111111111111111111;
(*  42.014  *)

[The a in the image and in the supplied code seem different.]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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