Loïc Grenié on Thu, 19 Sep 2024 10:40:06 +0200


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

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


On Thu, 19 Sep, 2024, at 10:30, Ilya Zakharevich wrote:
On Thu, Sep 19, 2024 at 09:39:15AM +0200, Aurel Page wrote:
> On 19/09/2024 06:30, Ilya Zakharevich wrote:
> > On Wed, Sep 18, 2024 at 10:38:09AM +0200, Aurel Page wrote:
> > > ? install("exponentfp","G");
> > > ? exponentfp(2^30-1)
> > > %2 = 29.999999998656385002
> > > ? exponentfp(Pi)
> > > %3 = 1.6514961294723207175
> > > ? z = Pi*2^20
> > > %4 = 3294198.6583305710348142047482656880163
> > > ? for(i=1,10^6,exponent(z))
> > > cpu time = 276 ms, real time = 276 ms.
> > > ? for(i=1,10^6,exponentfp(z))
> > > cpu time = 312 ms, real time = 312 ms.

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.

       Loïc