[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange division using mixed integers and floats
From: |
David Kastrup |
Subject: |
Re: Strange division using mixed integers and floats |
Date: |
28 Apr 2004 13:05:31 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
Richard Stallman <address@hidden> writes:
> But this behaviour is *highly* confusing:
>
> (/ 5 4 2.3) => 0.4347826086956522
>
> Cf. (/ 5 4.0 2.3) => 0.5434782608695653
>
> We could change the functions to convert the arguments to
> floating point at the start if any is floating point.
>
> Is there any reason not to do that?
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.
Also (/ 5 4 2.3) would no longer be equivalent to (/ (/ 5 4) 2.3).
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum