Ilya Zakharevich on Thu, 19 Sep 2024 16:37:26 +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 12:30:24PM +0200, Aurel Page wrote: > > 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… > I was quite puzzled by the complex branch too. But in any case when adding > other types we would apply the same recursion for t_COMPLEX as for > exponent(), i.e. maximum of result for real and imaginary parts. I think complex numbers are sufficiently different from vectors and polynomials to “continue to support log2(abs(x)) semantic”. As far as fixing the bug goes, “if only I knew a cheap way to do todbl(x/y) with precision 2^-43”, or do mantissa2dbl(x), then it would be easy to deal with it. Thanks, Ilya