Hacker News new | ask | show | jobs
by seles 5002 days ago
Setting MaxExtraPrecision to "to use as much automation as it needs to resolve numerical values" looks very interesting. It seems like it is being lazy, because the amount of precision needed isn't known until after the result is used (in this case the function that counts number of correct digits).

Any idea how this is implemented in mathematica?

1 comments

I don't know about mathematica specificly, but the standard way is lazily, as you say. You pass around a lazy list of digits (i.e. a partial list and a function that knows how to compute the next digit and the next function); it's trivial to add or subtract two such things, multiplication and division are harder but not too bad, and once you've got the idea square root and other more complex operations are pretty straightforward.