This line returns a Precision problem:


This one works fine:


What I don't understand is why one works while the other doesn't because I assume that internally Mathematica would numerically evaluate the argument of Floor first anyway, so the two lines should be logically equivalent, the 2nd one just redundant. But clearly I was wrong. What did I misunderstand about how Floor works?

  • $\begingroup$ Not an answer, but try Floor[Log[9]/Log[3]] // FullSimplify. -- Interesting, N also works: N[Floor[Log[9]/Log[3]]]. $\endgroup$
    – Goofy
    Feb 21, 2017 at 1:12
  • $\begingroup$ Maybe after an initial estimate of 2, it tries to determine whether it is greater than or less than 2. This gives a similar error: N[Log[9]/Log[3] - 2, 30]. $\endgroup$
    – Goofy
    Feb 21, 2017 at 1:20
  • 4
    $\begingroup$ Floor is discontinuous at the integers. Any attempt to use numeric methods on an exact example will have trouble there.That's what the message indicates. $\endgroup$ Feb 21, 2017 at 4:44
  • $\begingroup$ @DanielLichtblau But what is happening differently in the two lines of code I presented? $\endgroup$ Feb 21, 2017 at 7:54
  • 2
    $\begingroup$ as an example Floor[ Log[36]/Log[6] // N ] (*1*) $\endgroup$
    – george2079
    Feb 21, 2017 at 21:33

1 Answer 1


While the comments already contain a complete answer by Daniel Lichtblau, this behavior is also documented on ref/Floor, see the first example under 'Possible Issues':

Floor does not automatically resolve the value:

Floor[π^2 + 2 π + 1 - (π + 1)^2]

(* Floor::meprec: Internal precision limit
$MaxExtraPrecision = 50.` reached while evaluating Floor[1+2π+π^2-(1+π)^2]. *)

(* Floor[1 + 2 π + π^2 - (1 + π)^2] *)

Even though 1 + 2 π + π^2 - (1 + π)^2 is in fact the exact integer 0, it is a "hidden zero" which cannot be unmasked using purely numerical methods.

Unlike other functions like FullSimplify and PossibleZeroQ which may use symbolic algorithms, Floor is limited to numerical methods, see also this documentation note

For exact numeric quantities, Floor internally uses numerical approximations to establish its result.

and the numerical approximation will never yield an exact zero, no matter how much extra precision is allowed, e.g.

Block[{$MaxExtraPrecision = 1000}, N[π^2 + 2 π + 1 - (π + 1)^2, 50]]

Similarly, Log[9]/Log[3] is a "hidden integer". Numerical approximation of the exact quantity Log[9]/Log[3] - 2 is difficult, while numerical approximation of the machine precision number N[Log[9]/Log[3]] - 2 is not.


Your Answer

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

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