# Why the EuclideanDistance of these 2 exact points generates the warning N::meprec?

The two points are:

pts = {{1/4 (-1 - Sqrt[5]), Sqrt[5/8 - Sqrt[5]/8]},
{1/4 (-1 - Sqrt[5]), -Sqrt[5/8 - Sqrt[5]/8]}};
EuclideanDistance @@ pts


N::meprec: Internal precision limit $MaxExtraPrecision = 50. reached while evaluating 1/4 (-1-Sqrt[5])+1/4 (1+Sqrt[5]). >> (* Sqrt[4 (5/8 - Sqrt[5]/8) + Abs[1/4 (-1 - Sqrt[5]) + 1/4 (1 + Sqrt[5])]^2] *)  According to the document, EuclideanDistance[u, v] equals to Norm[u - v], so it's not surprising that a Norm version generates the same warning and result: Norm[Subtract @@ pts]  N::meprec: Internal precision limit$MaxExtraPrecision = 50. reached while evaluating 1/4 (-1-Sqrt[5])+1/4 (1+Sqrt[5]). >>

(* Sqrt[4 (5/8 - Sqrt[5]/8) + Abs[1/4 (-1 - Sqrt[5]) + 1/4 (1 + Sqrt[5])]^2] *)


The warning disappears if we choose Sqrt:

Sqrt[Total[(Subtract @@ pts)^2]]

(* Sqrt[4 (5/8 - Sqrt[5]/8) + (1/4 (-1 - Sqrt[5]) + 1/4 (1 + Sqrt[5]))^2] *)


Why? Simply a bug?

• No, not a bug. This is how Mathematica works. I think it is similar issue as this one mathematica.stackexchange.com/questions/31822/…. If you do this: $MinPrecision =$MachinePrecision; $MaxPrecision =$MachinePrecision; EuclideanDistance @@ pts the warning goes away. Mathematica needed more than 50 precision to decide on this one. That is all. You can also try $MaxExtraPrecision = Infinity; EuclideanDistance @@ pts but then you have to wait long time.... Sep 9, 2013 at 4:39 • see See wolfram.com/learningcenter/tutorialcollection/… page 20 for more discussion. Sep 9, 2013 at 4:39 • @Nasser I'm afraid that $MaxExtraPrecision = Infinity; won't work, at least it generates the warning General::nomem: The current computation was aborted because there was insufficient memory available to complete the computation. in my computer 囧. Sep 9, 2013 at 6:38
• Yes, same thing on my computer also, kernel actually crashed and I got an error message from C++ library. I did not say this will work, I said to try it :) Sep 9, 2013 at 6:41
• @xzczd If numerics-based zero-testing of an expression (that is symbolically zero) fails to produce trustworthy result of zero or non-zero at some precision, it typically fails to do so at every level of precision. This is documented issue for \$MaxExtraPrecision. Sep 9, 2013 at 6:49

Mathematica produces this Message during evaluation of Abs[1/4 (-1 - Sqrt[5]) + 1/4 (1 + Sqrt[5])]. It seemingly tries to calculate approximate value of this expression using N although the user does not ask for this. Note that
Simplify[Unevaluated@Abs[1/4 (-1 - Sqrt[5]) + 1/4 (1 + Sqrt[5])]]

produces no error messages and gives correct result (0). Evaluation of 1/4 (-1 - Sqrt[5]) + 1/4 (1 + Sqrt[5]) does not produce any messages. So the reason is that Abs has some internal code which evaluates numerically some exact but complicated expressions, and it is showed in the "Possible issues" section on the Documentation page for Abs.
• Oh… I should have check the document of Abs Sep 9, 2013 at 6:14
• Also, you can attempt to redefine Abs -> (Abs[FullSimplify[#]] &) with a internals-overriding function such as withReplacedFunctions in my answer here. Nonetheless the warning is just a warning and (mostly) harmless - worst it does is leaving the subexpression unevaluated. Sep 9, 2013 at 6:30