Bill Allombert on Sat, 14 Sep 2024 11:34:11 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: A missing (?) function: exponentfp(x)
|
- To: pari-dev@pari.math.u-bordeaux.fr
- Subject: Re: A missing (?) function: exponentfp(x)
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Sat, 14 Sep 2024 11:34:00 +0200
- Delivery-date: Sat, 14 Sep 2024 11:34:11 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=math.u-bordeaux.fr; s=2022; t=1726306445; bh=FlScevQvF+6AUZe60wlP7DLHR0/cHUXjvV8aQo9vF8U=; h=Date:From:To:Subject:References:In-Reply-To:From; b=KB8EJ/kLsbxYZlxAMv0WuERsk+Akf1SWn4NnNbV3og+yF4KgYvz+b7/qP7c0x8ZBg Ylgn53HnFVjy/IKEcpSZUQFvzUAHrkywMwICCk05QhWXINkqEkOpCy+V76eiFWnVnY yvATJqFM1fn9KFbQMjr99XgTh6xThr/1LhqCD65VGectViZ1yAbV6cYzLBsxi6jAOO 5XbTqA8hNYUbSmGF7HO0oW5MVskKDnxOQtbK1CeUYBuZeMJKVYKjAguvS/6pgvjNQ2 0Xe5EGZHlK5FTfvPGYdysh+v0C5v36B0rjzpUk2+1lndvG2+aXhZtIz0/vwnC3XuN3 zIOZv96ox7uSB849tsyNaRkPVglSiwwC60VRNFN5tcGiSvZCU1WU2gAGV0DG22c1mp 9Lr7XBoG7s04hSPx0RqTQ3iWPrxIR2MwB8OJgcLgpKeLb2bwljgcoD5hCgh63yThBv o3Hd6K9TcinshA3Rk0DaF6jY1fQHHaVtb9Q5T3iNYxzyTnM1ibHdZAQVEwrr7gs6xy Ig0v0nxzY2ODSpsTUibaiViOkSbxErOzOv13fB8tcRXNyu1sqj1d5k4IiTl9Xrmw4u iSn+wOJ885lFHJmQQcNpyP5oYH9EdYL3HCjDEm8a5CnICJx4JsvaDDQDOaqtSJpCi2 6jxbaZ8xyCymnK1W13nnUQZw=
- In-reply-to: <ZuVStcuY1kXNpxs6@debian.attlocal.net>
- Mail-followup-to: pari-dev@pari.math.u-bordeaux.fr
- References: <ZuVStcuY1kXNpxs6@debian.attlocal.net>
On Sat, Sep 14, 2024 at 02:09:09AM -0700, Ilya Zakharevich wrote:
> The function exponent(x) gives a very coarse value of log2(x). The
> function log(x)/log(2) gives a very fine value of log2(x) (but is
> slow, especially if x has high precision). But sometimes I prefer to
> know log2(x) with an intermediate precision; in fact, any sufficiently
> smooth monotonic function which coincides with log2 on powers of 2
> would be enough!
>
> In particular, exponent(x) + mantissa12(x) - 1 would be OK. (Here
> mantissa12() is the (top word of) mantissa-scaled-to-[1,2].) It
> should be very cheap to calculate. It may be beneficial to have two
> flavors, returning a double, or a 1-word PARI float.
>
> Is there something like this?
Why not do
? x=Pi;log(bitprecision(x,64))/log(2)
%1 = 1.6514961294723187981
(In C you can do log2(rtodbl(x)))
Cheers,
Bill.