*BSD News Article 32841


Return to BSD News archive

Xref: sserve comp.os.386bsd.bugs:2340 comp.os.386bsd.questions:11624
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yeshua.marcam.com!MathWorks.Com!panix!not-for-mail
From: wpaul@panix.com (Bill Paul)
Newsgroups: comp.os.386bsd.bugs,comp.os.386bsd.questions
Subject: Re: Floating point bug in FreeBSD?
Followup-To: comp.os.386bsd.bugs,comp.os.386bsd.questions
Date: 13 Jul 1994 19:54:47 -0400
Organization: The M00se Illuminati (bl00p!)
Lines: 57
Message-ID: <301us7$2qp@panix3.panix.com>
References: <steve.774119810@ichips.intel.com>
NNTP-Posting-Host: panix3.panix.com
X-Newsreader: TIN [version 1.2 PL2]

Daring to challenge the will of the almighty Leviam00se,
Steve Willoughby (steve@ichips.intel.com) had the courage to say:

: Sorry if this has been talked about before, but I just started reading the
: newsgroup.  I saw someone mention libm bugs in a previous article, and was
: wondering if that's related to a problem I'm seeing on my FreeBSD box.

[description of floating point bogosity munched for brevity]

: I wrote a quick C program using the supplied gcc compiler, and it too
: thinks sqrt(2)==2.  Sound familiar to anyone?  hardware FP problem?
: gcc bug? libm error?

Try FP emulation problem. Read on.

: The machine is a 386.  uname -a says, if I'm reading this correctly, that
: the version of FreeBSD is 1.0.2 GENERICBT#0 i386.

: I'm considering going with 1.1.5.1 now, but I'd like to know if that'll
: really solve my problem.

: Thanks for any help you can offer.
: -- 
: Steve Willoughby           Intel Corporation                 GCS d-- -p+ c+++

I think the precompiled binaries for perl et al. which you said wouldn't
run on your system might have been built for a newer version of FreeBSD
(1.1, at the very least). I say 'I think' because I haven't run 1.0.2
myself, but it's a likely explanation.

As for sqrt(2) == 2, this suggests that your system is using the
software FP emulation instead of a real 80387. The default math 
emulation available in FreeBSD is really bad, as you've apparently
discovered. (As an aside, I once tried running the 'paranoia'
program on FreeBSD 1.1 with the emulator and it got stuck in an
infinite loop while testing for underflow. :)

As of 1.1.5, however, FreeBSD also includes a port of the
Linux FPU emulator which is considerably more precise. It's still
not included in the default configuration (probably because it's
GNU copylefted), but building a new kernel with the new emulator
enabled is pretty simple. It might be possible to obtain a copy
of the Linux FPU emulator for 1.0.2, but my impression is that it
would be a good idea to upgrade the whole system anyway. Less trouble
in the end.

Hope this helps.

-Bill

--
 _      /\      _            Join the
/ \_/\_/  \_/\_/ \  .----.   M00se Illuminati   Bill Paul 
\_____/ () \_____/ (bl00p!)  Face it: wouldn't  <Big City M00se>
     /      \       `----'   you feel much      wpaul@panix.com   -or-
    /  \__/  \    --'        safer?             ghod@drycas.club.cc.cmu.edu
   /__________\