[Numeric-interest] Nelson Beebe on fdlibm
David Hough 754R work
754r at ucbtest.org
Mon Oct 27 11:37:29 PDT 2025
Please reply to Nelson if you have later information about fdlibm or
its derivatives. The last version I knew about was from 2002 -
https://www.ucbtest.org/software/
David Hough
> Date: Fri, 24 Oct 2025 14:56:26 -0600
> From: "Nelson H. F. Beebe" <beebe at math.utah.edu>
> Subject: Status of Sun Microsystems' Freely Distributable Math Library,
> fdlibm
>
> I had occasion today to run some tests of log1p() and expm1(),
> comparing results from the Linux -lm vs my -lmcw vs -lfdm, the
> latter built from Sun Microsystems' Freely Distributable Math Library.
>
> The latter at my site is a bundle fdlibm-5.3.2.2.tar.gz that
> contains my additional support for portability tweaks,
> GNU configure support. The most recent files in that bundle
> have these dates (from oldest to newest):
>
> -rw-rw-r-- 1 1087 Aug 2 2002 s_ilogb.c
> -rw-rw-r-- 1 4258 Apr 22 2004 k_tan.c
> -rw-rw-r-- 1 5002 Apr 22 2004 e_exp.c
> -rw-rw-r-- 1 1066 Apr 22 2004 w_exp.c
> -rw-rw-r-- 1 9675 Apr 22 2004 e_pow.c
> -rw-rw-r-- 1 7241 Apr 22 2004 s_expm1.c
> -rw-rw-r-- 1 8407 Apr 22 2004 README
> -rw-rw-r-- 1 545 Apr 28 2004 configure.in
> -rwxrwxr-x 1 105540 Apr 28 2004 configure
> -rw-rw-r-- 1 6271 Feb 16 2008 fdlibm.h
> -rw-rw-r-- 1 1002 Feb 16 2008 foo-sin.c
> -rw-rw-r-- 1 3100314 Feb 16 2008 foo-sin.out
> -rw-rw-r-- 1 8666 Feb 16 2008 k_rem_pio2.c.assert
> drwxrwsr-x 7 4096 Feb 16 2008 test
> -rw-rw-r-- 1 4630 Feb 16 2008 Makefile.in
> -rw-rw-r-- 1 1137 Feb 16 2008 ChangeLog
>
> The Netlib site at
>
> https://www.netlib.org/fdlibm/
>
> has individual files from this library, but I did not readily spot a
> single .tar or .zip file to grab them. I therefore used a recursive
> wget to pull them down, and then compared them against my latest
> holdings. There were differences in just five files, and then only in
> comments or version control timestamps. Thus, the fdlibm *.[ch] files
> in Netlib vs Utah can be considered identical.
>
> The Netlib files all have dates of 16-Mar-1995, more than three
> decades ago.
>
> Are any of you aware of further work elsewhere on fdlibm? Notably,
> for functions that work with IEEE 754 binary32, binary80, and
> binary128 formats.
>
> I also checked the -lultim and -lcrlibm libraries, which claim 100%
> correct rounding for binary64 functions, but neither library has the
> critical expm1() and log1p() functions, nor do they have functions for
> the three other IEEE 754 binary formats.
>
> My tests today compared the double versions of the three libraries
> against the long double (binary80) functions in the native -lm,
> producing output data files like these snippets.
>
> x fp_t_expm1(x) hp_t_expm1(x) relerr
> -0x1.000000p+1 -0x1.bab556p-1 -0x1.bab555p-1 0.1615 ulps
> -0x1.fffffcp+0 -0x1.bab554p-1 -0x1.bab554p-1 -0.1037 ulps
> -0x1.fffff8p+0 -0x1.bab554p-1 -0x1.bab553p-1 0.2093 ulps
> ..
> 0x1.fffff8p+0 0x1.98e63cp+2 0x1.98e63dp+2 -0.2422 ulps
> 0x1.fffffcp+0 0x1.98e644p+2 0x1.98e644p+2 -0.05100 ulps
> 0x1.000000p+1 0x1.98e64cp+2 0x1.98e64cp+2 0.1402 ulps
>
>
> x fp_t_log1p(x) hp_t_log1p(x) relerr
> 0x0.000000p+0 0x0.000000p+0 0x0.000000p+0 0.000 ulps
> 0x1.000000p-21 0x1.fffff8p-22 0x1.fffff8p-22 -6.358e-07 ulps
> 0x1.000000p-20 0x1.fffff0p-21 0x1.fffff0p-21 -2.543e-06 ulps
> ..
> 0x1.ffffd0p-1 0x1.62e418p-1 0x1.62e418p-1 0.02305 ulps
> 0x1.ffffe0p-1 0x1.62e420p-1 0x1.62e420p-1 0.02305 ulps
> 0x1.fffff0p-1 0x1.62e428p-1 0x1.62e428p-1 0.02305 ulps
> 0x1.000000p+0 0x1.62e430p-1 0x1.62e430p-1 0.02305 ulps
>
> The useful gnuplot tool that is in most O/S package systems makes it
> easy to visualize the errors as point plots like this:
>
> % gnuplot
> gnuplot> plot "test-expm1.dat.cc" using ($1):(4)
>
> On the screen, the plots from -lm and -lfdm appear to be identical,
> but running the diff command against the two files shows that about
> 1 in 840 lines differ for expm1(), and 1 in 610 for log1p(). That
> strongly suggests that the Linux and fdlibm implementations of those
> functions are likely to be extremely similar.
>
> Of 16M test results for expm1() with -lm and -lfdm, 1.34% are not
> correctly rounded. With my -lmw library, only 0.256% are not
> correctly rounded.
>
> For log1p, the corresponding failure rates are 1.38% (-lm and -lfdm)
> and 0.000429% (-lmcw).
>
> Apropos my desire for math functions that are correctly rounded, this
> paper was published earlier today:
>
> @String{j-COMP-SURV = "ACM Computing Surveys"}
>
> @Article{Brisebarre:2026:CRE,
> author = "Nicolas Brisebarre and Guillaume Hanrot and
> Jean-Michel Muller and Paul Zimmermann",
> title = "Correctly-Rounded Evaluation of a Function: Why, How,
> and at What Cost?",
> journal = j-COMP-SURV,
> volume = "58",
> number = "1",
> pages = "27:1--27:34",
> month = jan,
> year = "2026",
> CODEN = "CMSVAN",
> DOI = "https://doi.org/10.1145/3747840",
> ISSN = "0360-0300 (print), 1557-7341 (electronic)",
> ISSN-L = "0360-0300",
> bibdate = "Fri Oct 24 10:49:56 MDT 2025",
> bibsource = "https://www.math.utah.edu/pub/tex/bib/compsurv.bib;
> https://www.math.utah.edu/pub/tex/bib/fparith.bib",
> abstract = "The goal of this article is to give a survey on the
> various computational and mathematical issues and
> progress related to the problem of providing efficient
> correctly rounded elementary functions in
> floating-point arithmetic. We also aim at convincing
> the reader that a future standard for floating-point
> arithmetic should require the availability of a
> correctly rounded version of a well-chosen core set of
> elementary functions. We discuss the interest and
> feasibility of this requirement.",
> acknowledgement = ack-nhfb,
> ajournal = "ACM Comput. Surv.",
> articleno = "27",
> fjournal = "ACM Computing Surveys",
> journal-URL = "https://dl.acm.org/loi/csur",
> }
>
> The fparith.bib file records the 2024 version of that work as a HAL
> report. I sent a note a few minutes ago to the four authors to let
> them know that their important work has now been published in a highly
> respected journal in computer science.
>
> -------------------------------------------------------------------------------
> - Nelson H. F. Beebe Tel: +1 801 581 5254 -
> - University of Utah -
> - Department of Mathematics, 110 LCB Internet e-mail: beebe at math.utah.edu -
> - 155 S 1400 E RM 233 beebe at acm.org beebe at computer.org -
> - Salt Lake City, UT 84112-0090, USA URL: https://www.math.utah.edu/~beebe -
> -------------------------------------------------------------------------------
>
>
More information about the Numeric-interest
mailing list