Re: logb() vs floor(log2()) (was: Man page issues: logb, significand, cbrt, log2, log10, exp10)

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

 



Hi Morten,

On Mon, Mar 04, 2024 at 06:52:10PM +0100, Alejandro Colomar wrote:
> > logb:
> > The formula "floor(log2(x))" should be "floor(log2(fabs(x)))".  (Or
> > ...abs(...) if it's meant to be math and not C.)

I've applied thge following patch:

commit 1d83ce827aac984a26430b4f6107182f4b076874 (HEAD -> contrib, alx/contrib)
Author: Alejandro Colomar <alx@xxxxxxxxxx>
Date:   Tue Mar 5 00:20:09 2024 +0100

    logb.3: logb(x) is floor(log2(fabs(x)))
    
    log2(3) doesn't accept negative input, but it seems logb(3) does accept
    it.
    
    Link: <https://lore.kernel.org/linux-man/ZeYKUOKYS7G90SaV@debian/T/#u>
    Reported-by: Morten Welinder <mwelinder@xxxxxxxxx>
    Cc: Adhemerval Zanella Netto <adhemerval.zanella@xxxxxxxxxx>
    Signed-off-by: Alejandro Colomar <alx@xxxxxxxxxx>

diff --git a/man3/logb.3 b/man3/logb.3
index 7cbb2470a..7a1ad2f4a 100644
--- a/man3/logb.3
+++ b/man3/logb.3
@@ -58,7 +58,7 @@ .SH DESCRIPTION
 is 2,
 .BI logb( x )
 is equal to
-.BI floor(log2( x ))\fR,
+.BI floor(log2(fabs( x )))\f[R],\f[]
 except that it is probably faster.
 .P
 If



I'll push it tomorrow.

Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es/>
Looking for a remote C programming job at the moment.

Attachment: signature.asc
Description: PGP signature


[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