Subject: Re: Gnu Common Lisp HELP! From: Erik Naggum <email@example.com> Date: 1996/01/11 Newsgroups: comp.lang.lisp Message-ID: <19960111T202920Z@arcana.naggum.no> [Ola Andersson] | I am a new Lisp user and I would like to know why I get this result: | (SETQ INTEREST-RATE 0.1) | 0.10000000001 because it's correct. 0.1 cannot be expressed accurately with floating point. instead of floating point, use rational numbers, such as 1/10. representing and computing monetary values with floating-point is a well-known "sin". note that the Common Lisp `round' function rounds to even integers. this is the numerically correct solution, and works out best with money, as well. most people don't understand this, and insist on small errors. some national regulations even force people to be screwed by rounding errors. you may need to take this into account (pun intended). | I am using gcl v2.1. (What is the latest version?) version 2.2 has been released. look in math.utexas.edu:/pub/gcl. #<Erik 3030380960> -- the problem with this "information superhighway" is mainly that if you ask people to go play in it, they don't even understand when they get run over.