[net.micro.68k] Floating point implementations

serge@pacific.UUCP (serge) (01/09/86)

Is there some sort of standard in unix or IEEE for how to deal with the 
following floating point issues.  If there is no standard, what is the 
"preferred" action?  I am especially interested in how 68000-based 
systems behave, but would also be interested in knowing how other Unix 
systems deal with it.

		double a, b, c;
		  [assignment to b and c] 
		c = a / b;

	1) If `a' == 1.0 and `b' == 0.0 , should the divide-by-zero cause 
	   a SIGFPE?  (on some Unix systems it does not).  If a signal 
	   should not be generated, then what value should be
	   assigned to `c'?

	2) If SIGFPE is being ignored or caught (perhaps there are two
	   answers), what value should be assigned to `c'?  I suppose the 
	   possibilities are infinity, a NaN, or some random value since 
	   one could claim that dividing by zero produces an undefined result.

	3) If `a' and `b' above both contain infinity, then what should
	   happen (infinity divided by infinity is a Nan)?  Should SIGFPE
	   be generated in this case?  What if it is ignored or caught?

	4) If you manage to get the value of infinity or a nan into a
	   a float or double variable, what should printf(3) do with it
	   if you pass this value to it?  I have seen various Unix systems
	   deal with this in one of three ways:
		a) generate a SIGFPE
		b) print a large number (for infinity)
		c) go into an infinite loop (usually in ecvt(3))

Please respond by E-mail and I will post a summary if there is enough
interest.  I apologize if this has all been discussed before (if it
has, would someone please let me know what, if anything, was decided). 

	Thanks!

	Serge Issakow
-- 

	sdcsvax  \
	          >!pacific!serge
	s3sun    /

spaf@gatech.CSNET (Gene Spafford) (01/14/86)

You can obtain a copy of ANSI/IEEE Standard 754-1985, "IEEE Standard
for Binary Floating Point Arithmetic" by sending $6.50 plus $2 handling
to:
	IEEE Service Center
	445 Hoes Lane
	Piscataway, NJ 08854

NJ residents must add 6% sales tax to the $6.50 (= $6.89).  IEEE
members get a 10% discount (on the $6.50, *not* on the $2 handling) if
you include your member number with the order.

Canadian orders can be mailed to:
	IEEE Canadian Regional Office
	7061 Yonge St.
	Thornhill, Ont. L3T 2A6
and the conversion rate is US$ * 1.33 = CDN$

There are quantity discounts for 10 or more copies.  Details can be
directed to +1 201 981 0060.

I have all this information handy because I just ordered a copy....
-- 
Gene "the end is in sight" Spafford
The Clouds Project, School of ICS, Georgia Tech, Atlanta GA 30332-0280
CSNet:	Spaf @ GATech		ARPA:	Spaf%GATech.CSNet @ Relay.CS.NET
uucp:	...!{akgua,decvax,hplabs,ihnp4,linus,seismo,ulysses}!gatech!spaf