[comp.unix.ultrix] more surprises with IEEE NaN and INF on RISC Ultrix

mark@mips.COM (Mark G. Johnson) (09/25/90)

A couple more surprises in the ultrix math library: arc sine of x>1 returns
zero (not NaN); square root of x<0 returns zero (not NaN), and pow(x,y)
where x<0, y<0 returns zero (not NaN).  It's slightly better for libm43.a
except that the "pow" dumps core.

In article <1990Sep24.215337.26904@agate.berkeley.edu> lindahl@violet.berkeley.edu (Ken Lindahl   642-0866) writes:
  >
  >Finally, here's an observation and a possible bug: the log() function
  >in libm.a handles exceptions differently than the log() function
  >in libm43.a. Specifically,
  >
  >                        libm.a                libm43.a
  >                     --------------           ---------
  >log(0)              = NaN (negative)         = -Infinity
  >log(Infinity)       = NaN (negative)         = Infinity

   sqrt(-3.30)         = 0.00                   = NaN
   asin(6.60)          = 0.00                   = NaN
   pow(-4.40,-5.50)    = 0.00                   segmentation fault(core dumped)

  >
  >I don't know which of these behaviors is consistent with IEEE 754
  >(I haven't actually read it), but the libm43.a version seems more
  >useful to me. Beyond that, the math(3m) man page seems to imply that
  >libm.a and libm43.a should be comparable except perhaps for speed and
  >very small differences in returned values. This is not true for the 
  >the two versions of log(). Comments, anyone? By the way, I have not
  >performed any kind of exhaustive search for discrencies between libm.a
  >and libm43.a; I just stumbled across this one.
-- 
 -- Mark Johnson	
 	MIPS Computer Systems, 930 E. Arques M/S 2-02, Sunnyvale, CA 94086
	(408) 524-8308    mark@mips.com  {or ...!decwrl!mips!mark}