# N::meprec warning when setting precision

How come

N[ Log[ Cos[1]^2 + Sin[1]^2 ] ]


evaluates to 0. without any trouble, while

N[ Log[ Cos[1]^2 + Sin[1]^2 ], 1 ]


returns 0.*10^-67 but gives the warning message N::meprec: Internal precision limit \$MaxExtraPrecision = 50. reached while evaluating Log[Cos[1]^2+Sin[1]^2] ?

It's not that I'm asking for more digits. As a matter of fact: it gives this warning independent of the amount of digits I ask.

• I added some more details. Jul 1, 2021 at 11:06
• Use N[Log[Cos[1]^2 + Sin[1]^2] // Simplify, 1] Jul 1, 2021 at 14:02

This is because N[expr] uses machine precision, without any guarantees on the number of correct digits in the result. It simply uses machine numbers (approximately 15 decimal digits) during the intermediate steps of the computation.
N[expr, n] is different. It does not just use n-digit numbers during computation. Instead, it tries to ensure that the result is correct to n digits, which typically requires more than n digits during the calculation. This warning means that the system was unable to ensure that the result is correct to as many digits as you requested, even after using 50 extra digits (the current limit) in intermediate calculations.
Roughly speaking, in Mathematica "precision" refers to relative error and "accuracy" to absolute error. Computing absolute error is no problem with zero. We can make the error go away by requesting no n significant digits (precision) but n digits after to the right of the decimal point (accuracy). See N for the syntax.
N[Log[Cos[1]^2 + Sin[1]^2], {Infinity, 10}]
`