Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jul 1999 14:45:24 -0400 (EDT)
From:      Jeff Wheat <jeff@cetlink.net>
To:        freebsd-alpha@freebsd.org
Subject:   3.2-RELEASE problems IEEE Math
Message-ID:  <XFMail.990728144524.jeff@cetlink.net>

next in thread | raw e-mail | index | archive | help
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?

Best regards,
Jeff







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?XFMail.990728144524.jeff>