Date: Fri, 30 Dec 1994 12:43:34 +0400 From: Feisal Mohammed <feisal@ldc.uwi.tt> To: freebsd-questions@freebsd.org Subject: Re: Behavior of sqrt on errors. Message-ID: <9412300843.AA05740@uwi.tt>
next in thread | raw e-mail | index | archive | help
Hi, Mark Diekhans said, >>> On FreeBSD, >>> >>> sqrt (-3.0); >>> >>> generates a SIGFPE. On all other systems I have encountered, it calls >>> matherr with a DOMAIN error. Can anyone more knowledgeable about the >>> ANSI standard comment if this correct ANSI behavior or a bug? > In fact, this has to do with software (Tcl) that is ported to virtually > every Unix platform. In all of those implementations, either matherr or > returning a NAN (not-a-number) value is used to report the error. > I have seen the port of Tcl on ftp.freebsd.org, it does a fpsetmask(0) I use RLaB (a Matlab-like prog) under SunOS and also FreeBSD. The differences of the implementation causes the floating pt. errors to be handled less cleanly, e.g. 0/0 returns NAN on SunOS and a floating exception on FreeBSD, same for sqrt(). Clearly the better way is through the use of matherr as in SunOS. -Feisal
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9412300843.AA05740>