public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/11589] New: jn() Bessel function is massively imprecise at some points
@ 2010-05-12  1:58 pasky at suse dot cz
  2010-05-12  1:59 ` [Bug math/11589] " pasky at suse dot cz
  0 siblings, 1 reply; 6+ messages in thread
From: pasky at suse dot cz @ 2010-05-12  1:58 UTC (permalink / raw)
  To: glibc-bugs

(Steve Kargl and Tobias Burnus outlined the problem and proposed the method of
fixing it. See also https://bugzilla.novell.com/show_bug.cgi?id=583475.)

There appears to be a really nasty bug in jn() from fdlibm, which
is the foundation for most libm implementations (including glibc libm).
The zeroth-order j0() and first-order j1() cylindrical Bessel functions are used
to recursively generate the jn() value, but only the zeroth-order Bessel
function is used to normalize it; however, each of the functions gets highly
imprecise (approaching "bogus") near its zero point, making the jn() value
itself bogus.

But in fact, the zero points of j0() and j1() never coincide, thus j1() should
be used in case it is more precise than j0(). (That is, simply when its value is
further from zero.)

As an example, 2.4048255576957729_8 is the first zero of j0():

#include <stdio.h>
#include <math.h>

int
main ()
{
  double r8 = 2.4048255576957729;
  printf("%f\n", jn (3, r8));
  return 0;
}

The proper value as calculated by Mathematica is 0.19899990535769... However,
jn() returns -inf on 64-bit arch, or 0.185007 on 32-bit arch. With the proposed
patch below, the returned value is 0.199000.

Steve Kargl went on to measure the systematic error of j0():

> http://troutmask.apl.washington.edu/~kargl/j0f.jpg
> http://troutmask.apl.washington.edu/~kargl/j0f_1.jpg
>
> These are the error in j0f(x) near x = 2.404... measured in
> ULP. I've marched through this zero using nextafterf(), and
> you get about 9 million ULP in error, ie., 1 significant 
> decimal digit.

-- 
           Summary: jn() Bessel function is massively imprecise at some
                    points
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: pasky at suse dot cz
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=11589

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/11589] jn() Bessel function is massively imprecise at some points
  2010-05-12  1:58 [Bug math/11589] New: jn() Bessel function is massively imprecise at some points pasky at suse dot cz
@ 2010-05-12  1:59 ` pasky at suse dot cz
  0 siblings, 0 replies; 6+ messages in thread
From: pasky at suse dot cz @ 2010-05-12  1:59 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From pasky at suse dot cz  2010-05-12 01:59 -------
Created an attachment (id=4783)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=4783&action=view)
proposed patch


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=11589

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/11589] jn() Bessel function is massively imprecise at some points
       [not found] <bug-11589-131@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-09-10  2:17 ` drepper.fsp at gmail dot com
@ 2014-06-30 18:05 ` fweimer at redhat dot com
  3 siblings, 0 replies; 6+ messages in thread
From: fweimer at redhat dot com @ 2014-06-30 18:05 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=11589

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/11589] jn() Bessel function is massively imprecise at some points
       [not found] <bug-11589-131@http.sourceware.org/bugzilla/>
  2011-07-02 18:52 ` aj at suse dot de
  2011-07-12 14:20 ` aj at suse dot de
@ 2011-09-10  2:17 ` drepper.fsp at gmail dot com
  2014-06-30 18:05 ` fweimer at redhat dot com
  3 siblings, 0 replies; 6+ messages in thread
From: drepper.fsp at gmail dot com @ 2011-09-10  2:17 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=11589

Ulrich Drepper <drepper.fsp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Ulrich Drepper <drepper.fsp at gmail dot com> 2011-09-10 02:17:05 UTC ---
I've added the patch.  But it wasn't complete even for x86-64.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/11589] jn() Bessel function is massively imprecise at some points
       [not found] <bug-11589-131@http.sourceware.org/bugzilla/>
  2011-07-02 18:52 ` aj at suse dot de
@ 2011-07-12 14:20 ` aj at suse dot de
  2011-09-10  2:17 ` drepper.fsp at gmail dot com
  2014-06-30 18:05 ` fweimer at redhat dot com
  3 siblings, 0 replies; 6+ messages in thread
From: aj at suse dot de @ 2011-07-12 14:20 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=11589

Andreas Jaeger <aj at suse dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|aj at suse dot de           |drepper.fsp at gmail dot
                   |                            |com

--- Comment #3 from Andreas Jaeger <aj at suse dot de> 2011-07-12 14:20:09 UTC ---
Patch including an update for the testsuite:
http://sourceware.org/ml/libc-alpha/2011-07/msg00029.html

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/11589] jn() Bessel function is massively imprecise at some points
       [not found] <bug-11589-131@http.sourceware.org/bugzilla/>
@ 2011-07-02 18:52 ` aj at suse dot de
  2011-07-12 14:20 ` aj at suse dot de
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: aj at suse dot de @ 2011-07-02 18:52 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=11589

Andreas Jaeger <aj at suse dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |carlos at codesourcery dot
                   |                            |com

--- Comment #2 from Andreas Jaeger <aj at suse dot de> 2011-07-02 18:51:25 UTC ---
*** Bug 12292 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-30 18:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-12  1:58 [Bug math/11589] New: jn() Bessel function is massively imprecise at some points pasky at suse dot cz
2010-05-12  1:59 ` [Bug math/11589] " pasky at suse dot cz
     [not found] <bug-11589-131@http.sourceware.org/bugzilla/>
2011-07-02 18:52 ` aj at suse dot de
2011-07-12 14:20 ` aj at suse dot de
2011-09-10  2:17 ` drepper.fsp at gmail dot com
2014-06-30 18:05 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).