transcendental functions and compilation



On 2013-09-30, Robert Dodier <robert.dodier at gmail.com> wrote:

> Not sure what's the way out here. The translator could emit (CL:COSH $X)
> but if there is such a function in :maxima, we'd want to call it. Maybe:
>
>   (if (fboundp (find-symbol "COSH" :maxima))
>     <emit MAXIMA::COSH>
>     <emit CL:COSH>)

On looking at this some more, the right thing to do is to fetch the
appropriate function from the hash table *FLONUM-OP* (and I suppose
*BIG-FLOAT-OP* for bigfloat args). That way the translated code will
always exactly match interpreted code.

At present there is a property LISP-FUNCTION-TO-USE attached to several
math functions, including cosh. However that's problematic: not all of
the functions so named actually exist (e.g. SECH), and when they do,
they are not guaranteed to give exactly the same result as whatever is
named by *FLONUM-OP* (which punts to a single :cl or :maxima function
in some cases, but has some more complicated logic in some others).

At this point I'm inclinedd to make use of *FLONUM-OP* in translation
and nuke the LISP-FUNCTION-TO-USE business.

best

Robert Dodier