Re: logb() vs floor(log2())

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

 




On 04/03/24 14:52, Alejandro Colomar wrote:
> Hi Morten,
> 
> On Thu, Feb 29, 2024 at 07:28:10PM -0500, Morten Welinder wrote:
>> I came across some minor issues in some math man pages.
>>
>> M.
>>
>>
>>
>> logb:
>> The formula "floor(log2(x))" should be "floor(log2(fabs(x)))".  (Or
>> ...abs(...) if it's meant to be math and not C.)
> 
> Confirmed.  This is a bug in glibc too, BTW.  That text seems to be
> copied from their manual.
> 
> ISO C says this function is specified in ANSI/IEEE 854, but I don't have
> access to that document, so I'm not sure what's the specification of the
> function.  I'm not sure if it should fail for negative values (like
> log2(3)) or not; although the standard mentions the behavior for
> negative infinity, so it probably is specified to work for negative
> values too.
> 
> So, the behavior of the function seems to be correct, and it's just the
> manual that needs to be fixed.
> 
> I've CCed glibc, in case they want to comment.  But yeah, your
> suggestion seems correct.

It does seems to be an error on manual, could you send a patch to fix it?




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux