From: Harald Hanche-O. <ha...@ma...> - 2007-07-29 18:34:37
|
+ "Robert Dodier" <rob...@gm...>: | Considering (expt b x), it appears that expt returns something | other than the x-fold product of b, even if x is a small integer. | Seems to return (exp (* x (log b))) instead, which is OK, I guess, | but has the potential to be slightly surprising. Emphasis on slightly here, please. | E.g. this is what SBCL 1.0 on Linux yields. | | (let ((a 1.1234567890123456d0)) (- (expt a 5) (* a a a a a))) | => -2.220446049250313d-16 | | For comparison, Clisp 2.38, GCL 2.6.7, and Allegro Express 8.0 | all return 0.0d0 here. Why should this be a requirement? Consider the fact that "the x-fold product" is hardly a well defined concept, given that * is not associative over floating point numbers: (let* ((a 1.12345678901234d0) (aa (* a a))) (- (* aa aa a) (* a a a a a))) => -2.220446049250313d-16 - Harald |