From owner-freebsd-alpha Thu Jul 29 1:56:59 1999 Delivered-To: freebsd-alpha@freebsd.org Received: from herring.nlsystems.com (nlsys.demon.co.uk [158.152.125.33]) by hub.freebsd.org (Postfix) with ESMTP id 1035D14C18 for ; Thu, 29 Jul 1999 01:56:51 -0700 (PDT) (envelope-from dfr@nlsystems.com) Received: from salmon.nlsystems.com (salmon.nlsystems.com [10.0.0.3]) by herring.nlsystems.com (8.9.3/8.8.8) with ESMTP id JAA98840; Thu, 29 Jul 1999 09:59:36 +0100 (BST) (envelope-from dfr@nlsystems.com) Date: Thu, 29 Jul 1999 09:59:36 +0100 (BST) From: Doug Rabson To: Jeff Wheat Cc: freebsd-alpha@freebsd.org Subject: Re: 3.2-RELEASE problems IEEE Math In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 > #include > 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 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