| Ilya Zakharevich on Thu, 19 Sep 2024 12:24:53 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: A missing (?) function: exponentfp(x) |
On Thu, Sep 19, 2024 at 10:39:51AM +0200, Loïc Grenié wrote:
> > Unfortunately, thinking of this more: no go. You cannot pass through
> > a double without a correction of large exponents…
> The proposed patch of Aurel passes only the first word of the mantissa
> to log2.
Ah! Sorry! Did not pay enough attention (to rootpol.c, of all the places!)
Unfortunately, the complex branch of dbllog2() seems to be majorly
wrong…
Using flog2() wrapper defined earlier in this thread:
flog2delta(x)=flog2(x)-log(abs(x))/log(2);
(03:01) gp > flog2delta(1+0.0008*I)
%284 = -4.6166226535255913560320062458846938056 E-7
It seems that somebody wanted to write a Taylor series of order
BYTES_IN_LONG/4 (in 4**(-abs(x-y))/2?), but stopped at writing the 0th
term only…
Yours,
Ilya
P.S. But I think that a better solution is to bite the bullet and
permit "d" in the import signature, allowing returning
double.¹⁾ Maybe even allow "d" for convert-double-to-1-word,
and "dd" for convert-double-to-64-bits.
Of course, even then one would still need to allow all the
other types in dbllog2()…
¹⁾ Allowing double arguments would lead to a combinatorial
explosion, but double return is just one more 1-line
branch in addition to 4–5 already present.