From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 25 23:53:04 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85D84106566B for ; Thu, 25 Feb 2010 23:53:04 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.freebsd.org (Postfix) with ESMTP id 4BE108FC0C for ; Thu, 25 Feb 2010 23:53:04 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.4/8.14.4) with ESMTP id o1PNr3PM028195 for ; Thu, 25 Feb 2010 15:53:03 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.4/8.14.4/Submit) id o1PNr3Xb028194 for freebsd-hackers@freebsd.org; Thu, 25 Feb 2010 15:53:03 -0800 (PST) (envelope-from sgk) Date: Thu, 25 Feb 2010 15:53:03 -0800 From: Steve Kargl To: freebsd-hackers@freebsd.org Message-ID: <20100225235303.GA28105@troutmask.apl.washington.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i X-Mailman-Approved-At: Fri, 26 Feb 2010 00:13:01 +0000 Subject: Nasty bug in jn(3) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2010 23:53:04 -0000 There's a nasty little bug lurking in jn(3). #include #include 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