From owner-freebsd-hackers Tue Apr 25 0: 5:38 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from orion.ac.hmc.edu (Orion.AC.HMC.Edu [134.173.32.20]) by hub.freebsd.org (Postfix) with ESMTP id 8DC6137BCC0; Tue, 25 Apr 2000 00:05:29 -0700 (PDT) (envelope-from brdavis@orion.ac.hmc.edu) Received: (from brdavis@localhost) by orion.ac.hmc.edu (8.8.8/8.8.8) id AAA20157; Tue, 25 Apr 2000 00:05:23 -0700 (PDT) Date: Tue, 25 Apr 2000 00:05:23 -0700 From: Brooks Davis To: Nate Lawson Cc: freebsd-hackers@FreeBSD.ORG, freebsd-ports@FreeBSD.ORG, davidm@hpl.hp.com Subject: Re: floating point exceptions Message-ID: <20000425000523.A17224@orion.ac.hmc.edu> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i In-Reply-To: ; from nate@elite.net on Mon, Apr 24, 2000 at 11:44:59PM -0700 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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. FreeBSD has traditionaly violated the IEEE FP standard in this regard. This is fixed in 5.0 and I think in 4.0-STABLE (though I can't remember what file this is in so I can't check.) If upgrading to -stable isn't an option you can add a call to fpsetmask(3) in the application as follows (this will work on Solaris and Irix as well): #include <...> main() { fpsetmask(0); <...> } -- Brooks -- Any statement of the form "X is the one, true Y" is FALSE. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message