Long-float variant giving more precision to numerical computations.
Subject: Long-float variant giving more precision to numerical computations.
From: Raymond Toy (RT/EUS)
Date: Wed, 13 Feb 2008 09:59:33 -0500
Douglas Crosher wrote:
> Hello,
>
> Reworking the changes to use the maxima 'flonum type appears to work on GCL, CMUCL,
> and CLISP. The following changes are proposed as a first step:
>
> 1. Replace all float constants with the general form, e.g. 1d0 -> 1e0, and increase
> the precision to at least quad float precision. The *read-default-float-format*
> can then be modified to change all constants to an alternative format.
>
> 2. Replace all references to the double-float type with the 'flonum type, allowing
> the format used for a 'flonum to be changed easily.
I would accept changes to use flonum as the floating-point type.
>
> The handling of the Fortran code needs more thought, so would not be changed yet.
> Extending f2cl to allow translating the Fortran double precision type to a long-float
> or other type may be cleaner.
I modifying f2cl would be better. I think it's a bad idea to
hand-modify the generated code. f2cl already supports a :float-format
option, but I'm not sure that will work if it's changed from
'double-float to, say, 'flonum.
>
> An attempt has been made to use the CMUCL double-double-float type, and it does build
> but there are a few problems in CMUCL that need work, such as (rationalize 0.25w0)
> failing, and the lack of constants such as double-double-float-epsilon. If anyone
Oops. Rationalize is an oversight. I'll fix that. If you find other
issues, please let me know.
The problem with double-double-float-epsilon is that it's kind of fuzzy.
Look at what happens with (+ 1w0 1w-100). You get 1.<lots of
zeroes>1w0. This is an artifact of double-double representation. A
reasonable approximation would be (scale-float 1w0 -106), since there
are 106 bits of accuracy in a double-double.
Ray