*BSD News Article 38323


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yarrina.connect.com.au!warrane.connect.com.au!godzilla.zeta.org.au!not-for-mail
From: bde@zeta.org.au (Bruce Evans)
Newsgroups: comp.os.386bsd.development
Subject: Re: slow math library
Date: 25 Nov 1994 21:24:01 +1100
Organization: Kralizec Dialup Unix Sydney - +61-2-837-1183, v.32bis v.42bis
Lines: 39
Message-ID: <3b4e01$tua@godzilla.zeta.org.au>
References: <EYMUB1UR@math.fu-berlin.de> <JTC.94Nov21103825@rtl.cygnus.com>
NNTP-Posting-Host: localhost.zeta.org.au

In article <JTC.94Nov21103825@rtl.cygnus.com>,
J.T. Conklin <jtc@cygnus.com> wrote:
>>>>>> "Thomas" == Thomas Graichen <graichen@omega.physik.fu-berlin.de> writes:
>
>Thomas> ... - i've also tried the msun lib (from 1.1.5)
>Thomas> - but i can't see the big improvement - but floating point
> ...
>I maintain the SunPro fdlibm derived math library for NetBSD and
>DJGPP.  I understand that the FreeBSD folks have integrated a copy I
>gave to Jordan into their OS as "msun".
>
>I'm surprised that you have found it to be so much slower than the
>Linux libm.  Before someone can start addressing the differences, it
>would be useful to know what (math) operations your programs use.

The main difference is probably that FreeBSD by default configures
`msun' to not use the FPU or FPU emulator for math functions.  Define
HAVE_FPU if you have a real FPU (i387 or DX486 or pentium).

>One thing that you might try is to recompile the library with
>-D_IEEE_LIBM and without -D_MULTI_LIBM and -D_POSIX_MODE.  I don't

-D_IEEE_LIBM is the default for FreeBSD-1.1.5.

`-D_MULTI_LIBM -D_POSIX_MODE -D_IEEE_LIBM' is the default for
FreeBSD-2.0, but this combination of defines is bogus.  It is
actually almost equivalent to -D_IEEE_LIBM.  -D_POSIX_MODE is the
"correct" default.  Unfortunately, it breaks IEEEish error reporting
(NaNs get converted to numbers).

>really think it can make that much of a difference, since it only
>effects error handling.

Yes, it should only slow down math functions by no more than a few
percent.

Bruce
-- 
Bruce Evans  bde@zeta.org.au