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

Re: CLTL compatible type contagion?

Raymond Toy wrote:
> However, I was doing some numerical prototyping with clisp and came
> across this very annoying problem with the current type contagion:
> 	(+ 1d50 1.0)
> does not return 1d50.  Instead, it signals a floating-point overflow.
> I presume that clisp does the addition in double-float and then
> coerces the result to single-float, causing the overflow.
> This behavior makes numerical work more difficult than it
> should be.

This is weird to me because:

(+ 1d50 1)

-> 1.0d50


(+ 1d50 1d0)

-> 1.0d50

but as pointed out, adding 1.0 or 1e0 causes the overflow error.  Is
this consistent?

Richard Shepherd. 
WWW home page:- http://therat.math.waikato.ac.nz/