Dieter Kaiser wrote:
> Hello Ray,
>
> that is the code in simp-expintegral-si which calls expintegral-si:
>
> ((expintegral-numerical-eval-p arg)
> (let ((carg (complex ($realpart arg) ($imagpart arg))))
> (complexify (expintegral-si carg))))
>
> Here a CL complex number is generated and transferred to the numerical routine
> expintegral-si. I am not sure, but I think this would be the best place to make
> sure that the argument carg has the correct declaration. Is a declaration at
> this point enough to make sure that the numerical routines work as expected?
Declarations don't do anything. But if you meant that we make sure carg
is a complex flonum, then yes, this would work.
But now, I think making expintegral-si do the right thing might be
better, in case some one later says, hey, here's a Si function I can
use, then passes a fixnum to it and wonders why the precision isn't what
was desired.
>
> Later I would like to use a different test which I use to standardize the
> numerical evaluation a bit. In other functions I have written code like this:
>
> ((complex-float-numerical-eval-p arg)
> (let ((carg (complex ($float ($realpart arg)) ($float ($imagpart arg)))))
> (complexify (expintegral-si carg))))
>
> The functions float-numerical-eval-p, complex-numerical-eval-p, .. I have
> written to get a standard for a call to the numerical routines. Would the
> additional $float guarantee that the argument carg has the correct and complete
> declaration?
Yes, this should work.
>
> This is the equivalent code for the Exponential Integral Ci in
> simp-expintegral-ci which calls the numerical routine expintegral-ci. Again a CL
> complex number is transferred to the numerical routine.
>
> ((expintegral-numerical-eval-p arg)
> (let ((carg (complex ($realpart arg) ($imagpart arg))))
> (complexify (expintegral-ci carg))))
>
This needs to be changed too. Interestingly, the testsuite didn't
complain about Ci not having enough precision, but the Si test did.
That's how I found the problem with expintegral-si.
Ray