Re: puzzling/buggy floating point handling RMCL/MCL?

Brian Mastenbrook <brian-kh4umrmO1yM/[email protected]> Thu, 17 Sep 2009 13:13:24 -0500
Newsgroups gmane.lisp.mcl.general
Message-ID <[email protected]>
*read-default-float-format* is relevant here:

"Controls the floating-point format that is to be used when reading a  
floating-point number that has noexponent marker or that has e or E  
for an exponent marker."

So 2.0e7 is a double-float if *read-default-float-format* is double- 
float.

The RMCL crash is definitely a bug. I'm not sure why regular MCL is  
working with double-floats when you set *read-default-float-format* to  
short-float.

On Sep 17, 2009, at 1:01 PM, E.J. Chichilnisky wrote:

> folks,
>
> Can anybody make head or tail of this apparent bug in MCL/RMCL
> implementation of expt?
>
> ;; problem: dependence of expt on *read-default-float-format*
> ;; MCL -- causes inappropriate error when *read-default-float-format*
> should not matter
> ;; RMCL -- crashes the application
>
>
> (setq *read-default-float-format* 'double-float)
>
> ;; appropriate error -- floating point overflow
> (null (expt 2.0e7 2.0e7))
>> Error: FLOATING-POINT-OVERFLOW detected
>>       performing EXPT on (2.0D+7 2.0D+7)
>
> ;; no error
> (null (expt 2.0e7 6.0))
>
>
>
> (setq *read-default-float-format* 'short-float)
>
> ;; appropriate error -- floating point overflow
> (null (expt 2.0e7 2.0e7))
>> Error: FLOATING-POINT-OVERFLOW detected
>>       performing EXPT on (2.0D+7 2.0D+7)
>
> ;; inappropriate error in MCL, crashes RMCL
> ;; nobody asked for type coercion to short-float!!!!
> (null (expt 2.0e7 6.0))
>> Error: Can't coerce 6.4D+43 to SHORT-FLOAT
>> While executing: CCL::%DOUBLE-FLOAT->SHORT-FLOAT

--
Brian Mastenbrook
brian-kh4umrmO1yM/[email protected]
http://brian.mastenbrook.net/

_______________________________________________
info-mcl mailing list
[email protected]
http://clozure.com/mailman/listinfo/info-mcl