Subject: Re: Comments on the "Report of the Numerics Working Group"

From: [email-masked]
Date: Thu, 10 Sep 1998 18:05:42 -0400

Joseph Darcy writes:

> Small integers are exactly representable as floating point numbers.
> Therefore, 2.0 + 1.0 yields 3.0 exactly.  For the float format, this
> holds until the integers get larger in magnitude than 16,777,216.  In
> other words, for integer floats smaller in absolute value than 2^24,
> adding 1.0 has no rounding error; the operation is exact.  Therefore,
> until adding 1.0 does cause rounding errors, the transformed program
> is functionally equivalent to the original.  So if the loop was
> something like for(i=0; i<=100; i++){...} a Java compiler could
> perform the transformation.

Jose Moreira replies:

What about the transformation of:

    do i = 1,n
       x[i] = Pi*float(i)
    end do

into

    xi = 0.0
    do i = 1,n
       xi = xi + Pi
       x[i] = xi
    end do

Now I suspect we have rounding issues.

---

From: "Joseph D. Darcy" <[email-masked]>
Date: Thu, 10 Sep 1998 15:16:02 -0700 (PDT)

> Now I suspect we have rounding issues.

Certainly since Pi*i will very rarely be exact.  In general, if the
multiplications were exact they could be replaced by the additions.
Small integers are an important special case.

-Joe Darcy
[email-masked]