Skip to main content
20 votes

Why does SetPrecision not apply to 0?

If you have a value $x$ with an absolute uncertainty $dx$ the precision of $x$ is by definition: $$\text{Precision}(x) = - \log_{10}(dx/x)$$ That is why for $x=0$ the precision is always infinity. ...
Ray Shadow's user avatar
  • 7,836
17 votes
Accepted

Why does 1 - Exp[-10.0^12] cause an out-of-memory error?

Actually this is not a duplicate. The prior question is about underflows that require massive bignums to represent at machine precision, and that much is present here as well. So what @J.M notes is ...
Daniel Lichtblau's user avatar
14 votes
Accepted

Really understanding precision

Here are my thoughts: Q1 Machine numbers: For machine numbers, what you describe is correct. I would just add that you can use InputForm or FullForm to see all the digits if desired: ...
Carl Woll's user avatar
  • 131k
13 votes
Accepted

Fast integer square-root

Sqrt is using exact methods in an effort to pull out "small" squares. This is going to take time. A direct approach, as already noted, would do the square root ...
Daniel Lichtblau's user avatar
12 votes
Accepted

How are Accuracy and Precision related Mathematica for a given operation?

Precision is the principal representation of numerical error Except for numbers that are equal to zero, error in arbitrary-precision numbers is stored internally as its precision. For numbers equal ...
Michael E2's user avatar
  • 237k
12 votes
Accepted

How to force Mathematica to do infinite-precision calculations?

Mathematica will perform exact arithmetic only so long as all quantities are expressed as exact numbers. 90.12 is an inexact number with machine precision (i.e. ...
WReach's user avatar
  • 69k
11 votes

Machine-Precision and Arbitrary Precision

This is not an answer. But I don't believe we should close this question as "easily found in the documentation". Numerics in Mathematica is an extremely complicated and mostly undocumented subject, ...
11 votes

Why does SetPrecision not apply to 0?

From SetPrecision: See also Precision and Accuracy.
11 votes

Fast integer square-root

Not directly addressing the question about GMP library, but you can get a Sqrt much faster starting with an extended precision float. ...
george2079's user avatar
10 votes

$N[a,50]-N[a,10]=0$ why? and what's the rationale behind?

The problem with using N to generate arbitrary precision numbers is that is it will generate more digits of accuracy than asked for: ...
Michael E2's user avatar
  • 237k
10 votes
Accepted

How to disable roundoff error tracking in arbitrary precision arithmetic?

There are a few reasonable ways. I'll illustrate with an example of Newton iterations for square roots, take from this MathGroup post ...
Daniel Lichtblau's user avatar
10 votes

Why do I get number with Precision larger than error estimate?

Consider any numerical integration method $I^*(f,a,b)$ that approximates the exact integral $I$ of a function $f$ over an interval $[a,b]$. It will be implemented by a computation represented by, say, ...
Michael E2's user avatar
  • 237k
9 votes

Arbitrary-Precision Arithmetic behaves unexpectedly

This is at best a partial answer. I don't know in full detail what is going on with FullForm or InputForm but I will venture to ...
8 votes

Elegant high precision `log1p`?

LogLogPlot[{Internal`Log1p[x], Log[1 + x]}, {x, 1*^-17, 1*^-14}] ps:Of course,maybe you need Internal`Expm1,too.
yode's user avatar
  • 26.8k
8 votes

How are Accuracy and Precision related Mathematica for a given operation?

Accuracy and Precision are related though RealExponent The relation between ...
rhermans's user avatar
  • 36.7k
8 votes
Accepted

Error and uncertainty propagation: Is using Precision/Accuracy a sound strategy?

Your problem is similar to a wave spectra problem and a regression problem, and I have both types of problems going on at work right now which is why I've thought about your problem a bit. Here is an ...
Chris Chiasson's user avatar
8 votes
Accepted

How do I convert an inexact number smaller than $MinMachineNumber to machine-precision?

This situation is comparable to $MinMachineNumber / 2 automatically giving an arbitrary precision result. ...
Szabolcs's user avatar
  • 235k
8 votes
Accepted

plot of polynomial expression failed

$Version (* "11.2.0 for Mac OS X x86 (64-bit) (September 11, 2017)" *) $HistoryLength = 0; (* for comparing timings *) expr[a_] = `<your expression>` The ...
Bob Hanlon's user avatar
  • 159k
8 votes

Mathematica precision common problems

WRI Support solved my precision issue by using $Pre to SetPrecision on all MachineNumberQ ...
Edmund's user avatar
  • 42.3k
8 votes
Accepted

Why does N not upgrade precision?

N can only lower precision, it cannot raise precision. N[1.3`4, 10] //Precision 4. Since ...
Carl Woll's user avatar
  • 131k
7 votes

How do I convert an inexact number smaller than $MinMachineNumber to machine-precision?

number = 5.803736411761291186334053015446685`16*^-400; number + 0. (* 0. *) N makes arbitrary precision numbers when either ...
John Doty's user avatar
  • 13.7k
7 votes
Accepted

What is wrong with importing Real32 or Real64?

I don't think there's a problem. It's a question of output-formatting, connected with the fact that there are single-precision binary fractions that cannot be represented in decimal form in 17 digits ...
Michael E2's user avatar
  • 237k
6 votes
Accepted

MachinePrecision versus $MachinePrecision in NDSolve

I was looking for a previous question of which this might be a duplicate; although many previous discussions hinge on precision issues, and the difference has been mentioned in comments, I could not ...
MarcoB's user avatar
  • 67.3k
5 votes
Accepted

Has "faster arbitrary precision computation of elementary functions" been incorporated into Mathematica?

Posting my earlier comment as an answer: Yes, as of 11.0.0.
ilian's user avatar
  • 25.5k
5 votes

When can I assume that all decimal digits returned by Mathematica are provably correct?

Update As @MichaelE2 points out, perhaps I didn't directly answer your question. I think the short answer is that you can rely on precision of the output if you are using adaptive precision control, ...
Carl Woll's user avatar
  • 131k
5 votes

Making a calculation with high precision

In V11.0 we try: N[1/Sqrt[1 - (150^2 10^(-4))/(9 10^16)] - 1] we get an answer of 0. As Michael E2 points out we are getting subtractive cancellation causing ...
bobbym's user avatar
  • 2,638
5 votes
Accepted

Why this very simple problem turns to "Indeterminate"?

You have X=Y=c because a and b are 10^36 smaller than c and the machine precision is 10^-15. Here you are working in machine precision (a machine precision number has nothing after the `) It is ...
andre314's user avatar
  • 18.6k
5 votes
Accepted

Linear Algebra in Arbitrary Precision - SLOW

Setting $MinPrecision and $MaxPrecision equal saves some time: ...
Michael E2's user avatar
  • 237k
5 votes
Accepted

Does SetPrecision[x, Infinity] expose the internal exact number in the approximated number?

This is another way to get the exact number stored internally, including any guard bits: ...
ilian's user avatar
  • 25.5k

Only top scored, non community-wiki answers of a minimum length are eligible