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

Re: CLTL compatible type contagion?

    Bruno>         (+ 1d40 1e37)

    Bruno> Returning 1.001d40 for this would be wrong (IMO) since the two numbers,
    Bruno> considered as intervals, add up like this:

    Bruno>          1d40 +/- 1e24
    Bruno>          1e37 +/- 1e29
    Bruno>      =================
    Bruno>      1.001d40 +/- 1e29

This is a nice example of why the answer should be a single-float.

But what about this example?

	  1.000001 +/- 1e-8
	- 1.000000 +/- 1e-8
	  0.000001 +/- 2e-8

What should the type of the result be?  Something less than a
short-float?  The current scheme seems like a half-attempt at interval
arithmetic.  Either go all the way or don't go at all.


P.S.  If I sound harsh or antagonistic, I'm not.  I'm just really
curious about how clisp does it's arithmetic and the reasoning behind
it.  I have found that clisp is at least as good as gcl and cmulisp
(the only lisp implementations I used) in speed and executable size
for general purpose prototyping.  Clisp only loses when I do
heavy-duty floating point operations, and, then, only if I'm very
careful to declare everything correctly.