Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jul 1999 09:59:36 +0100 (BST)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Jeff Wheat <jeff@cetlink.net>
Cc:        freebsd-alpha@freebsd.org
Subject:   Re: 3.2-RELEASE problems IEEE Math
Message-ID:  <Pine.BSF.4.10.9907290957400.385-100000@salmon.nlsystems.com>
In-Reply-To: <XFMail.990728144524.jeff@cetlink.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 28 Jul 1999, Jeff Wheat wrote:

> Hi there. I am new to this list as recently installing 3.2
> on my alphastation 250 4/266. I must start by saying it was
> amazingly simple to install considering I was using the serial
> console!
> 
> Anyhow, I am attempting to compile a package that uses IEEE math
> and I am running into trouble.
> 
> Here is the test program:
> 
> #include <signal.h>
> #include <floatingpoint.h>
>         int main(void){
>               double a;
>               double b=22.0;
>               double c;
>               signal(SIGFPE,SIG_IGN);
> //#              fpsetmask(0);
>                 a=0.0/0.0;
> 
>              c=b/a;
>               if (!isnan(c)) return 1;
>               c=a==c?1.0:0.0;
>               if (c>0.0) return 1;
>               c=a==c?1.0:0.0;
>               if (c>0.0) return 1;
>               c=a>c?1.0:0.0;
>               if (c>0.0) return 1;
>               c=a<c?1.0:0.0;
>               if (c>0.0) return 1;
>               c=a>=c?1.0:0.0;
>               if (c>0.0) return 1;
>               c=a<=c?1.0:0.0;
>               if (c>0.0) return 1;
>               return 0;
>              }
> 
> Here are the results:
> alpha# gcc nantest.c -o nantest ; ./nantest ; echo $?
> 1
> alpha# gcc nantest.c -O -o nantest ; ./nantest ; echo $?
> 0
> alpha# gcc nantest.c -O1 -o nantest ; ./nantest ; echo $?
> 0
> alpha# gcc nantest.c -O2 -o nantest ; ./nantest ; echo $?
> 0
> alpha# gcc nantest.c -ieee -o nantest ; ./nantest ; echo $?
> 1
> 
> This seems odd that optimization would cause these differences.
> 
> Can anyone suggest what the problem is?

The problem is that the alpha requires floating point code to be written
in a special way to allow NaNs. INFs and denorms to work properly.
Unfortunately the compiler in 3.2-RELEASE is not able to generate the
right code. This is fixed in -current (use the -mieee flag) and will be
fixed in 3.3 (different flags which I can't remember right now).

--
Doug Rabson				Mail:  dfr@nlsystems.com
Nonlinear Systems Ltd.			Phone: +44 181 442 9037




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9907290957400.385-100000>