Re: [BENCHMARK] AIM Independent Resource Benchmark results for kernel-2.5.44

Jakob Oestergaard (jakob@unthought.net)
Tue, 29 Oct 2002 00:17:38 +0100


On Mon, Oct 28, 2002 at 12:28:39PM -0600, Nathan Straz wrote:
> >
> > The AIM7/AIM9 new_raph is broken code. The convergence loop termination
> > conditional looks something like:
> > if (delta == 0) break;
> > for a type "double" delta. You ought to change that to be something
> > like:
> > if (delta <= 0.00000001L) break;
>
> I usually specify the compiler flag -ffloat-store and that fixes the
> issue for me.

Maybe that will work as a work-around. But it is nothing but a
work-around. The previous poster was right - the code is broken.

The "==" operator usually doesn't have any reasonable use on floating
point values (yes there are cases where it makes sense, but this is not
one of them).

A result from any computation on double values cannot be assumed to
"equal" anything in particular. Zero included.

The correct way to terminate that loop is, like was already suggested,
doing a comparison to see if the residual is "numerically zero" or
"sufficiently zero-ish for the given purpose". Eg. "delta < 1E-12" or
eventually "fabs(delta) < 1E-12".

Comparing to zero makes *no* sense. It's written by someone who has no
understanding of numerics (or perhaps just didn't think clearly at that
moment - /me trying not to insult more people than strictly necessary ;)

-- 
................................................................
:   jakob@unthought.net   : And I see the elder races,         :
:.........................: putrid forms of man                :
:   Jakob Østergaard      : See him rise and claim the earth,  :
:        OZ9ABN           : his downfall is at hand.           :
:.........................:............{Konkhra}...............:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/