Bill Allombert on Sat, 14 Sep 2024 12:49:29 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: A missing (?) function: exponentfp(x)


On Sat, Sep 14, 2024 at 12:31:57PM +0200, Loïc Grenié wrote:
>      In gp you can cheat
> 
> ? install(dbllog2,lG);
> ? install(dbltor,L);
> ? flog2(x)=dbltor(dbllog2(x));

It is not robust because the calling convention put double in different
registers than long so dbltor would not find its input.
However it can work by luck if the value stay in the floating point registers:

? a=dbllog2(Pi); dbltor(a)
%13 = 0.E-307
? dbltor(dbllog2(Pi))
%14 = 1.6514961294723207175

But then you can as well do:

install(dbllog2,vG);
install(dbltor,"");
flog2(x)=dbllog2(x);dbltor();
flog2(Pi)
%10 = 1.6514961294723207175

Cheers,
Bill.