# Tag Info

14

The Emacs Lisp constant pi is not actually the number 𝜋. Rather, the Emacs Lisp constant pi is an approximation to 𝜋, good to about 16 digits -- pi is exactly 3.141592653589793115997963468544185161590576171875, which is the IEEE 754 binary64 floating-point number closest to 𝜋. This is also the floating-point number closest to 3.141592653589793, which is ...

5

I think this is simply the expected answer. As a float, 1.2246467991473532e-16 is not different from zero, given the floating point error Emacs Lisp can handle. One get the same answer in R for instance: sin(pi) #> [1] 1.224647e-16 and also in Python, as shown in this thread. Actually, this is said in the Emacs Lisp manual: Floating-point computations ...

5

You are doing nothing wrong. This function is working with floating point numbers which have good, but limited, accuracy. 1.2246467991473532e-16 is pretty close to 0 (0.0... with 15 zeros before the 1224... kicks in).

Top 50 recent answers are included