From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6d7a86bff9319841 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Where I find Bessel function for Ada ? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <111195bd-6d60-42e6-8ce1-bf7c27a2f665@u14g2000yqg.googlegroups.com> Date: Wed, 26 Nov 2008 18:17:03 +0100 Message-ID: <5rukpfxv15it.17kah89egv5pw$.dlg@40tude.net> NNTP-Posting-Date: 26 Nov 2008 18:17:06 CET NNTP-Posting-Host: 8ee0eac2.newsspool2.arcor-online.net X-Trace: DXC=HH\iGk@b`G^Fm0Y?OE@2^XA9EHlD;3YcR4Fo<]lROoRQ^YC2XCjHcbY4XCjf8D;S`]DNcfSJ;bb[UIRnRBaCd On Wed, 26 Nov 2008 08:12:21 -0800 (PST), Ludovic Brenta wrote: > On Nov 26, 4:09 pm, Ken Thomas wrote: >> As the code for bessj0 is very short, translation to Ada is a small >> exercise. On the other hand, the code seems to deal with only single >> precision arithmetic so does not promise high accuracy. > > I suppose this is easy to fix by making the Ada implementation > generic. The user then instantiates it for any floating-point type > with the required accuracy. An ability to do so depends on the accuracy of the constants used in the implementation. A good-designed library should have the accuracy of the result within n * T'Model_Epsilon or, better, within the range f(x)'Pred..f(x)'Succ. It is non-trivial to do for a generic package. Short types will suffer accuracy losses due to insufficient precision. Long precision types will due to inaccuracy of the coefficients. Most likely in a generic body you will need some "carrier" type of the precision higher than of the argument type. In some cases T'Base can help. In others it cannot... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de