From owner-freebsd-hackers Tue Apr 25 7:47:21 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from hplms26.hpl.hp.com (hplms26.hpl.hp.com [15.255.168.31]) by hub.freebsd.org (Postfix) with ESMTP id C119837B7D4; Tue, 25 Apr 2000 07:47:14 -0700 (PDT) (envelope-from davidm@hpl.hp.com) Received: from mlhub26.hpl.hp.com (root@mlhub26.hpl.hp.com [15.9.144.132]) by hplms26.hpl.hp.com (8.9.3 (PHNE_18979)/HPL-PA Relay) with ESMTP id HAA23009; Tue, 25 Apr 2000 07:47:03 -0700 (PDT) Received: from napali.hpl.hp.com (napali.hpl.hp.com [15.4.89.123]) by mlhub26.hpl.hp.com (8.9.3 (PHNE_18979)/8.9.3 HPL-PA Hub) with ESMTP id HAA21383; Tue, 25 Apr 2000 07:47:01 -0700 (PDT) Received: (from davidm@localhost) by napali.hpl.hp.com (8.9.3/8.9.3) id HAA22117; Tue, 25 Apr 2000 07:47:01 -0700 From: David Mosberger MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14597.45029.383712.138944@napali.hpl.hp.com> Date: Tue, 25 Apr 2000 07:47:01 -0700 (PDT) To: Brooks Davis Cc: Nate Lawson , freebsd-hackers@FreeBSD.ORG, freebsd-ports@FreeBSD.ORG, davidm@hpl.hp.com Subject: Re: floating point exceptions In-Reply-To: <20000425000523.A17224@orion.ac.hmc.edu> References: <20000425000523.A17224@orion.ac.hmc.edu> X-Mailer: VM 6.75 under Emacs 20.4.1 Reply-To: davidm@hpl.hp.com X-URL: http://www.hpl.hp.com/personal/David_Mosberger/ Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG OK, having to call fpsetmask(0) is an acceptable workaround. So if I do: #ifdef __freebsd___ fpsetmask(0); #endif Then this should work on all versions of freebsd? --david >>>>> On Tue, 25 Apr 2000 00:05:23 -0700, Brooks Davis said: Brooks> On Mon, Apr 24, 2000 at 11:44:59PM -0700, Nate Lawson wrote: >> I am running FreeBSD 4.0-RELEASE on x86 with gcc 2.95.2 and the >> httperf-0.6 port gives a SIGFPE and dumps core when run against a >> system that has no web server running. (The default behavior is >> to measure localhost when no arguments are specified). >> >> It seems this is caused by a divide by zero error since the delta >> between connections ends up being zero. The author suggest that >> the divide should return a defined value, Inf, according to the >> IEEE floating point standard. FreeBSD generates SIGFPE. I >> temporarily patched the code locally to check for a delta of zero >> and arbitrarily set it to 1.0 so that the divide succeeds and >> everything comes out ok without crashing. >> >> Is FreeBSD's behavior correct? Why or why not? You can use the >> included code snippet to verify that this occurs. Brooks> FreeBSD has traditionaly violated the IEEE FP standard in Brooks> this regard. This is fixed in 5.0 and I think in 4.0-STABLE Brooks> (though I can't remember what file this is in so I can't Brooks> check.) If upgrading to -stable isn't an option you can add Brooks> a call to fpsetmask(3) in the application as follows (this Brooks> will work on Solaris and Irix as well): Brooks> #include <...> main() { Brooks> fpsetmask(0); <...> } Brooks> -- Brooks Brooks> -- Any statement of the form "X is the one, true Y" is Brooks> FALSE. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message