This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH/gfortran] Fix handling of subnormal numbers


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]