Date: Tue, 11 Feb 1997 13:49:16 +1100 From: Bruce Evans <bde@zeta.org.au> To: gurney_j@resnet.uoregon.edu, markd@Grizzly.COM Cc: freebsd-current@freebsd.org, freebsd-gnats-submit@freefall.freebsd.org, mcclure@cs.unm.edu Subject: Re: misc/229 floating point exception on illegial values.. Message-ID: <199702110249.NAA31773@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>>I believe that this is what is suppose to happen... you use SIGFPE to >>trap these errors and possibly rerun the function after correcting the >>problem.... acording to the math(3) man page an exception is suppose to >>occure on invalid values... No. math(3) says "NOTE: An Exception is not an Error unless handled badly". It doesn't say that the default FreeBSD handling is always bad :-]. >As the default behavior, this causes a great amount of pain when porting >software to BSD. No other system that I know of works in this manner. >Its a royal pain for things like Tcl and other interpreters that want to >check errno after calling a math function. BSD's libraries are both advanced and broken here. The old libm almost never sets errno. Instead, for domain errors, it attempts to return a NaN and attempts to set the IEEE exception bit for invalid operand. These attempts, especially the setting of the exception bit, are sometimes broken by gcc's lack of support for IEEE floating point and libm's faith in the compiler's lack of optimization. The new libm (msun) has support for setting errno, but for various reasons this support is not enabled by default in FreeBSD. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702110249.NAA31773>