[Patch,Fortran] PR36158 - Add transformational version of BESSEL_JN intrinsic

Tobias Burnus burnus@net-b.de
Thu Aug 19 07:30:00 GMT 2010


  On 08/19/2010 05:34 AM, Steve Kargl wrote:
> I read your patch and it appears to be correct,
> except that 2.0 in mpfr_ui_div should probably
> be an integer 2.

Fixed. I also added a link to DLMF for the recurrence algorithm.

> I haven't had time to investigate your program and
> findings, but I have no reason to suspect that your
> results are flawed.  I am somewhat puzzled by them.
> After all the work you did, I hesitate to suggest
> that I would rather have gfortran produce correct
> results slowly (ie, n2 - n1 + 1 calls to mpfr_{jn,yn})
> than to get possibly wrong results fast via
> recurrence algorithm.  If you want to change back
> to your original algorithm that's fine with me;
> otherwise, the current patch can be committed and
> I'll see if I can find time to poke at it.

I have committed the version with the recurrence algorithm but added a 
note to intrinsics.texi that the transformational version uses a 
recurrence algorithm which might lead to different results than invoking 
the elemental function. From what I have heard from the J3/WG5 committee 
the transformational version has been added explicitly because it allows 
the implementation of the recurrence algorithm. Thus, it makes sense to 
use it.

The next step is to add an implementation for run-time evaluation, which 
will also use the recurrence algorithm - thus the mpfr and the run-time 
version will give the same result, which is useful by itself.

I think it were be useful if you could find time to poke at it. One 
could also consider using the algorithm for JN but not for YN - but 
first one should do more checks to make sure that I haven't just been 
lucky that JN worked so well.

Thanks for reviewing. Committed as Rev. 163364.

Tobias



More information about the Fortran mailing list