Subject: Re: Would COMPILER-MACRO cut it? From: Erik Naggum <erik@naggum.no> Date: 2000/01/27 Newsgroups: comp.lang.lisp Message-ID: <3157981207714177@naggum.no> * Christopher Browne | Using floats for something that is inherently rational seems to me to | be fundamentally irrational. (And there are too many puns there to | feel comfortable...) the machine representation of a floating point number _is_ a rational! specifically, M*2^E, for Mantissa (an integer) and Exponent (an integer), usually with a separate sign, but that's beside the point. contrary to common beliefs, floating point numbers _are_ exact, they just aren't the numbers we'd _like_ to be exact, because we stupidly cling to decimal instead of hexadecimal or octal. | The *problem* with using floats for financial operations is that this | causes you to enter into all the numerical stability issues that are | rampant in FP math. this is sheer nonsense. the reason we run into numerical stability issues in floating point arithmetic operations is that we're asking the system to find the representable (exact) number that is closest to the (exact, but unrepresentable) result of a computation. as long as the result is representable, floating point arithmetic cannot but remain exact and stable. | <ick-mode> | Common Lisp probably needs to have a BCD numeric representation for | this purpose. | </ick-mode> supporting BCD numeric representation only makes sense when the hardware also supports it. for all common, relevant purposes, arbitrary-precision integers suffice. #:Erik