# How does Mathematica evaluate N[π, 30] == π?

I want to know how N[π, 30] == π works. The result is True. I wonder whether the exact number π is truncated to a $MachinePrecision number or N[π, 30] is extended to an exact number in a way similar to the output of this instruction N[Pi, 30] // FullForm (like stated here). • Look at the "Detail" of the docs for Equal: "Approximate numbers with machine precision or higher are considered equal if they differ in at most their last seven binary digits (roughly their last two decimal digits)..." (of the precision of the expreassion, which is the lowest precision present, i.e. 30 digits in your example). – Michael E2 Dec 26 '19 at 17:27 • @MichaelE2 What is a bit puzzling is that SetPrecision[N[Pi, 30], 55] == Pi evaluates to True as well even though naïvely there appears to be a difference of not 7, but 25 digits. – Szabolcs Dec 26 '19 at 17:29 • @MichaelE2 Although SetPrecision[N[Pi, 30], 55] - Pi evaluates to somethign of the order$10^{-54}\$. Freak accident? – Szabolcs Dec 26 '19 at 17:30
• @Szabolcs All the digits in N[Pi, 30] // FullForm are correct, and there are more than 55 of them. So it is equal to Pi to 55 digits. (The internal form of arbitrary precision carries extra guard digits. How many varies.) – Michael E2 Dec 26 '19 at 17:30
• N[π,30] does not extend uniquely, so that's not a possibility. Such equality testing is performed at the smallest numeric precision of the input. – Daniel Lichtblau Dec 26 '19 at 19:21