emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: expt weirdness in floatfns.c


From: Luc Teirlinck
Subject: Re: expt weirdness in floatfns.c
Date: Sat, 6 Aug 2005 18:43:08 -0500 (CDT)

Richard Stallman wrote:

   The comment suggests this was for compatibility with Common Lisp.
   We may as well not change it.

I do not see how Emacs can be compatible with Common Lisp in this
respect, since it does not implement rational numbers.  From the CL Hyperspec:

    expt returns base-number raised to the power power-number. If the
    base-number is a rational and power-number is an integer, the
    calculation is exact and the result will be of type rational;
    otherwise a floating-point approximation might result.

>From the Common Lisp implementation CLISP:

[1]> (expt 2 -2)
1/4

which is consistent with the above quote.

To be compatible with CL, Emacs should return 1/4, which it can not
do, having no rational numbers.  0.25, even though inexact, would
appear to be more "compatible" with 1/4 than 0.

Sincerely,

Luc.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]