[PATCH/gfortran] Fix handling of subnormal numbers

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Thu Apr 14 17:57:00 GMT 2005


Tobias Schlüter wrote:
> We'll need this because we will want to model target arithmetic precisely,
> including precision loss.  Say for a contrived example, someone wants to
> determine the exponent range and does something like
>    x = 1.5; y = 1.5; i = 1
>    DO WHILE (y==x)
>       y = x**(-i)
>       y = x**i
>       i = i + 1
>    END DO
>    ! Precision loss occured, i is now abs(minexponent) + precision
>    ! (possibly off-by-one)

It's amazing how many mistakes I made in those few lines.
    x = 1.5; y = 1.5; i = 1
    DO WHILE (y==x)
       y = x*(2.**(-i))
       y = y*(2.**i)
       i = i + 1
    END DO
This is more like what I intended.

- Tobi


- Tobi



More information about the Gcc-patches mailing list