10
$\begingroup$

Summary: once Mathematica hits an overflow error, N[] appears to break for even simple calculations.

RealDigits[N[Sqrt[2]-1,10^8]];

I was impressed that Mathematica ran the code above (first 100 million decimal digits of Sqrt[2]) without running out of memory, so I then started a new session and did this:

RealDigits[N[Sqrt[2]-1,5*10^8]];                                        

General::ovfl: Overflow occurred in computation.

General::ovfl: Overflow occurred in computation.

$MaxPrecision::prec: 
   In increasing internal precision while attempting to evaluate -1 + Sqrt[2]
    , the limit $MaxPrecision = Infinity
     was reached. Increasing the value of $MaxPrecision may help resolve the
     uncertainty.

RealDigits::fnumx: 
   The value Overflow[] did not evaluate to a sufficiently precise finite
     number.

Disappointing, but OK. Now, however, in the same session:

N[Sqrt[2], 50]                                                          

$MaxPrecision::prec: 
   In increasing internal precision while attempting to evaluate Sqrt[2]
    , the limit $MaxPrecision = Infinity
     was reached. Increasing the value of $MaxPrecision may help resolve the
     uncertainty.

Out[3]= Overflow[]

It appears that hitting Overflow[] once breaks N[] from then on.

In[4]:= $Version                                                                

Out[4]= 9.0 for Linux x86 (32-bit) (November 20, 2012)

Thoughts?

$\endgroup$
2
  • 11
    $\begingroup$ Looks like a problem in the caching scheme. As work around, could do ClearSystemCache["Numeric"]. I will report this issue. $\endgroup$ Commented Sep 14, 2016 at 16:19
  • $\begingroup$ This issue has been fixed in the development version. Thank you for pointing it out. $\endgroup$
    – ilian
    Commented Sep 19, 2016 at 4:55

1 Answer 1

2
$\begingroup$

Transitioning my comment into an answer, this is a bug that has been fixed as of Mathematica 11.1.0

N[Sqrt[2]-1,5*10^8];                                                    

General::ovfl: Overflow occurred in computation.

$MaxPrecision::prec: 
   In increasing internal precision while attempting to evaluate -1 + Sqrt[2]
    , the limit $MaxPrecision = Infinity
     was reached. Increasing the value of $MaxPrecision may help resolve the
     uncertainty.

N[Sqrt[2], 50]

(* 1.4142135623730950488016887242096980785696718753769 *)
$\endgroup$

Your Answer

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