public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Alejandro Colomar <alx@kernel.org>,
	Morten Welinder <mwelinder@gmail.com>
Cc: linux-man@vger.kernel.org, libc-help@sourceware.org
Subject: Re: logb() vs floor(log2())
Date: Mon, 4 Mar 2024 15:47:26 -0300	[thread overview]
Message-ID: <bddcd00f-7adf-4558-9733-6a71906b46ed@linaro.org> (raw)
In-Reply-To: <ZeYKUOKYS7G90SaV@debian>



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?

  reply	other threads:[~2024-03-04 18:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CANv4PNkVv_0eLgiSP3L_KfC-eZJaVLZ5AP1AGfD0GNrR5M4Hrg@mail.gmail.com>
2024-03-04 17:52 ` logb() vs floor(log2()) (was: Man page issues: logb, significand, cbrt, log2, log10, exp10) Alejandro Colomar
2024-03-04 18:47   ` Adhemerval Zanella Netto [this message]
2024-03-04 22:16     ` logb() vs floor(log2()) Alejandro Colomar
2024-03-04 23:23   ` logb() vs floor(log2()) (was: Man page issues: logb, significand, cbrt, log2, log10, exp10) Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bddcd00f-7adf-4558-9733-6a71906b46ed@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=alx@kernel.org \
    --cc=libc-help@sourceware.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mwelinder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).