From owner-freebsd-current Mon Feb 10 18:55:51 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id SAA05748 for current-outgoing; Mon, 10 Feb 1997 18:55:51 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id SAA05741 for ; Mon, 10 Feb 1997 18:55:46 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.3/8.6.9) id NAA31773; Tue, 11 Feb 1997 13:49:16 +1100 Date: Tue, 11 Feb 1997 13:49:16 +1100 From: Bruce Evans Message-Id: <199702110249.NAA31773@godzilla.zeta.org.au> To: gurney_j@resnet.uoregon.edu, markd@Grizzly.COM Subject: Re: misc/229 floating point exception on illegial values.. Cc: freebsd-current@freebsd.org, freebsd-gnats-submit@freefall.freebsd.org, mcclure@cs.unm.edu Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >>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