Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: "Joseph Ashwood" <ashwood@msn.com>
To: <axp-list@redhat.com>
Subject: Re: Floating point on alpha - SOLUTION 1
Date: Tue, 2 Jul 2002 13:45:52 -0700	[thread overview]
Message-ID: <007601c22209$e53b1620$6501a8c0@josephas> (raw)
In-Reply-To: 200207021927.g62JRe912800@mx1.redhat.com

----- Original Message -----
From: "Linus Gasser" <ineiti@gmx.net>

> F*CK with -miee I can divide by 0 w/o trouble! What the heck is this? I
can
> have
>
> double a = 0, b = 1, c = 2;
> b = c / a;
>
> Someone wake me up! What is going on here?

There are a few possible explanations, sorry I don't know which one it is
don't have Alpha docs in front of me right now. Depending on the chip
itself, it may actually have a 0 for floating point numbers, 0 will actually
be 2^-500 or something, which will introduce very small errors, but usually
nothing that is critical. This takes care of division by 0 very cleanly, by
eliminating the possibility. The second possibility is that division by 0
results in a special code output, IIRC Alpha does NOT use this one, it is
exclusively the realm of PowerPC. Third possibility, division by 0 creates
an output of infinite, if you print this to the screen it is generally
printed as "#INF" or something similar. The fourth possibility is
that -mieee switched off the floating point signaling completely so your
division by 0 error goes undetected, and b receives garbage. It will take
some experimentation and documentation to determine which of these (possibly
case 1 and 3 in some cases) is the actual result.

If you are writing something the needs to be portable, you will need to
address all of these cases, since different systems behave slightly
differently.
                            Joe




  reply	other threads:[~2002-07-02 20:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-02 13:10 Floating point on alpha Peter Petrakis
2002-07-02 19:37 ` Floating point on alpha - SOLUTION 1 Linus Gasser
2002-07-02 20:45   ` Joseph Ashwood [this message]
2002-07-02 21:18     ` Chris Eleveld
2002-07-02 22:32       ` Joseph Ashwood
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox