Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* IEEE Floating Point problem
@ 1994-09-01 16:43 David Williss
  1994-09-02  7:50 ` Burkhard Neidecker-Lutz
  0 siblings, 1 reply; 2+ messages in thread
From: David Williss @ 1994-09-01 16:43 UTC (permalink / raw)


I have a problem with floating point on our OSF/1 machine (It's a DEC 
Alpha).  IEEE specifies that the result of dividing anything by 0
should be INF or -INF (depending on the numerator), with the exception
that 0/0 and INF/INF are both NaN (Not A Number).

On our alpha/OSF/1, These procuded FP Exceptions and exited with a
core dump.  I found the man page ieee(3), and it gave some suggestions,
none of which did what I wanted.

If you set it up to ignore SIGFPE, the result of 1/0 is 0 (not INF).
It suggested the compiler flag -resumption_safe, which it says will
make it produce the correct IEEE result, but it still gives 0.
I tried the flag on the cc compiler.  gcc doesn't even have the flag.

Is there any way to get this to behave correctly?
--
David C. Williss    				#include <StdDisclaimer.h>
Software Engineer -- MicroImages, Inc.		dwilliss@microimages.com
Voice: (402) 477-9562	 FAX: (402) 477-9559	dwilliss@csealumni.unl.edu


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: IEEE Floating Point problem
  1994-09-01 16:43 IEEE Floating Point problem David Williss
@ 1994-09-02  7:50 ` Burkhard Neidecker-Lutz
  0 siblings, 0 replies; 2+ messages in thread
From: Burkhard Neidecker-Lutz @ 1994-09-02  7:50 UTC (permalink / raw)


In article <3450c9$hvg@crcnis1.unl.edu> dwilliss@csealumni.unl.edu (David Williss) writes:
>I have a problem with floating point on our OSF/1 machine (It's a DEC 
>Alpha).  IEEE specifies that the result of dividing anything by 0
>should be INF or -INF (depending on the numerator), with the exception
>that 0/0 and INF/INF are both NaN (Not A Number).
>
>On our alpha/OSF/1, These procuded FP Exceptions and exited with a
>core dump.  I found the man page ieee(3), and it gave some suggestions,
>none of which did what I wanted.

	% cat a.c
	#include <stdio.h>

	main(argc,argv)
	int argc;
	char *argv[];
	{
	  double i,j;

	  i = 5;
	  j = 0;
	  printf("%f\n",i/j);
	}
	% cc a.c
	% ./a.out
	Floating exception
	% cc -ieee_with_no_inexact a.c
	% ./a.out 
	INF

If you want IEEE semantics, you have to tell the compiler with the
-ieee_xxx flags. This *is* in the cc(1) man page.

		Burkhard Neidecker-Lutz

GLASS Project, CEC Karlsruhe 
Advanced Technology Group, Digital Equipment Corporation
neideck@nestvx.enet.dec.com



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1994-09-02  7:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-09-01 16:43 IEEE Floating Point problem David Williss
1994-09-02  7:50 ` Burkhard Neidecker-Lutz

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