emacs-devel
[Top][All Lists]
Advanced

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

Re: Strange division using mixed integers and floats


From: Andreas Schwab
Subject: Re: Strange division using mixed integers and floats
Date: Wed, 28 Apr 2004 16:02:50 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> Efficiency?  Lisp is not a statically typed language.  We don't know
> the type of the arguments until after they have been evaluated.
>
> We would have to store all intermediate results away before being
> allowed to do the first operation.

Which we do anyway, since / is not a special form.  Arguments of normal
functions are always evaluated before being applied.

> Also (/ 5 4 2.3) would no longer be equivalent to (/ (/ 5 4) 2.3).

I don't think it was ever documented as such.  The Emacs Lisp manual only
covers the case of all arguments being integers, but does not specifically
say anything about mixed mode arguments, except that a floating point
value is returned if any argument is floating.  So always using floating
point arithmetics in this case would fit the principle of least surprise.

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

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