Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Feb 2010 15:53:03 -0800
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        freebsd-hackers@freebsd.org
Subject:   Nasty bug in jn(3)
Message-ID:  <20100225235303.GA28105@troutmask.apl.washington.edu>

next in thread | raw e-mail | index | archive | help
There's a nasty little bug lurking in jn(3).

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

int
main(void)
{
	double z;
	int i, n;

	z = 2.4048255576957729;
	for (n = 2; n < 10; n++)
		printf("%d %e\n", n, jn(n,z));

	return (0);
}

troutmask:kargl[446] cc -o z testjn.c -lm
troutmask:kargl[447] ./z
2 4.317548e-01
3 -inf
4 4.069027e-02
5 -inf
6 3.247664e-03
7 -inf
8 7.495602e-05
9 -inf

I can assure you that -inf is not a valid value for
an integer order Bessel function at z = 2.40482555...
A quick inspection of e_jn.c suggest a similar
problem maybe found at other zeros of j0(x).

-- 
Steve



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100225235303.GA28105>