What went wrong?
[1]> (log (exp 1))
0.99999994
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is due to the finite precision of floating-point representations of fractional numbers.
Please see: http://en.wikipedia.org/wiki/Floating_point
(exp 1)is going to be an approximation ofe(which requires infinite precision to represent perfectly). The natural logarithm of that approximation will be approximately (but not exactly)1. Understanding floating-point representation will allow you to understand why this happens.CLISP is using your machine architecture’s native representation of floats. Most commonly by far, this representation is in one the formats specified by IEEE 754 (typically 32- or 64-bit; in your case it looks like 32-bit). In a nutshell, fractional parts are represented by a sum of inverse powers of 2 (i.e., some combination of
1/2,1/4,1/8, …1/2^32, etc.)