Article View: muc.lists.freebsd.bugs
Article #526[Bug 300884] [libm] What to do about Bessel functions.
From: bugzilla-noreply
Date: Thu, 19 Nov 2026 00:03
Date: Thu, 19 Nov 2026 00:03
90 lines
5365 bytes
5365 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300884
Bug ID: 300884
Summary: [libm] What to do about Bessel functions.
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: bin
Assignee: bugs@FreeBSD.org
Reporter: kargl@FreeBSD.org
Created attachment 277436
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277436&action=edit
whitespace cleanup
Cylindrical Bessel and Neumann functions were imported into FreeBSD in ancient
times
from NetBSD with lineage back to fdlibm. Little work (and apparently little
testing)
has been done with these functions. For simplicity, consider exhaustive
testing of
j0f(x) over the range of normal numbers:
% ./tlibm j0 -fPED -x min -X max
Interval tested for j0f: [1.17549e-38,3.40282e+38]
ulp <= 0.5: 68.721% 1464234486 | 68.721% 1464234486
0.5 < ulp <= 0.6: 3.541% 75438635 | 72.261% 1539673121
0.6 < ulp <= 0.7: 3.328% 70912912 | 75.589% 1610586033
0.7 < ulp <= 0.8: 3.117% 66412840 | 78.706% 1676998873
0.8 < ulp <= 0.9: 2.889% 61549741 | 81.595% 1738548614
0.9 < ulp <= 1.0: 2.646% 56376976 | 84.241% 1794925590
1.0 < ulp <= 1.5: 9.466% 201697211 | 93.707% 1996622801
1.5 < ulp <= 2.0: 4.263% 90827446 | 97.970% 2087450247
2.0 < ulp <= 3.0: 1.886% 40181343 | 99.856% 2127631590
3.0 < ulp : 0.144% 3074841 | 100.000% 2130706431
Max ulp: 3654467.50000000 at 3.15364697e+38 0x1.da821p+127
The group of values with ULP above 3.0 include value
near the zeros of j0f(x), e.g.,
% ./tlibm j0 -fa 2.40482545
x = 2.40482545e+00f, /* 0x1.33d152p+1, 0x4019e8a9 */
libm = 5.96342957e-08f, /* 0x1.00209ap-24, 0x3380104d */
mpfr = 5.64343985e-08f, /* 0x1.e4c48ep-25, 0x33726247 */
ULP = 900690.68928773
Yes, that is only one correct significant digit. Can we
do better. Yes. (Otherwise, there is no point in this
bug report). With a rewritten src/e_j0f.c, I have
% ./tlibm j0 -fPED -x min -X max
Interval tested for j0f: [1.17549e-38,3.40282e+38]
ulp <= 0.5: 99.990% 2130491097 | 99.990% 2130491097
0.5 < ulp <= 0.6: 0.010% 215331 | 100.000% 2130706428
0.6 < ulp <= 0.7: 0.000% 1 | 100.000% 2130706429
0.8 < ulp <= 0.9: 0.000% 1 | 100.000% 2130706430
3.0 < ulp : 0.000% 1 | 100.000% 2130706431
Max ulp: 4.61369371 at 3.15364697e+38 0x1.da821p+127
% ./tlibm j0 -fa 2.40482545
x = 2.40482545e+00f, /* 0x1.33d152p+1, 0x4019e8a9 */
libm = 5.64343985e-08f, /* 0x1.e4c48ep-25, 0x33726247 */
mpfr = 5.64343985e-08f, /* 0x1.e4c48ep-25, 0x33726247 */
ULP = 0.31071227
The 3 outliers with ULP > 0.6 occur for x > 0x1p127. If one is
using j0f(x) in this range of x, you're likely doing something
quite wrong.
The first patch in a hopefully series of patch is attached.
It is a whitespace cleanup of src/e_jn[f].c. It tries to
follow style(9) recommendations. Note, I only fixed leading
indentation of comments. Comments require much more effort to
cleanup and fix. Updating whitespace in e_j[01][f].c is
not done as I've rewritten those entirely.
--
You are receiving this mail because:
You are the assignee for the bug.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID:
<bug-300884-227@https.bugs.freebsd.org/bugzilla/>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail From: bugzilla-noreply@freebsd.org Newsgroups: muc.lists.freebsd.bugs Subject: [Bug 300884] [libm] What to do about Bessel functions. Date: Thu, 19 Nov 2026 00:03:02 +0000 Organization: Newsgate at muc.de e.V. Approved: news-admin@muc.de Distribution: world Message-ID: <bug-300884-227@https.bugs.freebsd.org/bugzilla/> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2"; logging-data="49569"; mail-complaints-to="news-admin@muc.de" X-Original-To: bugs@mlmmj.nyi.freebsd.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795046582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jc0+NSa1Tf8wgf4ULRLPlHqK0zqSvgRuPXdldhMGNas=; b=uiq5dRAzypQJUQ2S6laepvIAqzLEi8BbuIQM2t7GXmN9nh4+qVXibpbmugDN//QRenuMHB P2F0baaBkC0RuRumr6FYV04greMb8CGnJlL7xp7t/EUBTo2pe5wJJdlsNZb9j3w8toD8Hg FCwfgnM3qTztJjEn1lVqw7EmvxfSR5aat1hZMTIGwJNj/oozacXmC0qS0rBUUYlqvPBNuG FZ6aSYRW/ICa5+tNpU3KJbytlFN1IwjntDZOWGvMjzeXP/xo0C4JnsRUb23xuLMEIo22Kv r1oJ8Vplo0TxPx+cKQX5qhXYpqpB4QhOSFjjTVKv8URRfLdEsHfPJsiHL87pcA== X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f Auto-Submitted: auto-generated Precedence: list X-Newsgate-Id: f02c70b8849f+ X-No-Archive: Yes