From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 36E903858D28 for ; Mon, 4 Mar 2024 18:47:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 36E903858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 36E903858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::630 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709578053; cv=none; b=FwnEO1BFeTAio4aIg/3oqHwyMX2Rv5TTG+B8RM6czK6SKMiiuZk/W6tnpS7GtNE9YX94uJ66xWt88lvdKdsaoMiKXRC3IvRVwzltflVFDIG+BljGg3rpdz6gmUpykSrGK41EFPWkFrRwP5a4KiiAB8wJqrtEecRjQOSqoNbiVqQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709578053; c=relaxed/simple; bh=V9RbBZ0zZo3v/XyfMbkHmxnLDQGwyaXsU08+Jjv71nI=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=KGe5J2U898aQ1+MsX6FqrR7nANuX73M51etn7EY3wr6LEb3YtKxR07CQaRuSKugjSJ0hzUBuZpKCBP8Pwmc7qXIeoUyWX42DyLt1fiqTMHyPv2x85KP2GyBHrTjiKV1o1Pir8M5AHSlaUlvccxJ3t7gK3ntYe1Um1OJ8R2qJDVI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1dd10ae77d8so9670745ad.0 for ; Mon, 04 Mar 2024 10:47:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709578050; x=1710182850; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=bPWx/2YJ6inT4AzN3TSSoDvg/VeRAtNCqChMNNUNVpE=; b=GudHwRgTbr04aZK1AglFSQd59a+Gv5r6e7J1AZVK5rdLNNJ8j/mVSmqrdMEVaWnYVv wISdSEmuEUIQPicRIIVtjeoUGkxlmopgMq4v47F0xxZwqisUPHCdBK+YgiVAYFmhJV30 TwXa9sfoTDpuD6Rw6RDm4PEaBzCmhPrDQA2xCfc/7O/7eHoUlJbaXMT31uVuZXfEFXJ7 zWfJ/Vvp/FYOAlcBz0k8hCLv41lNEa042cQ4hGedZjM9p+J7WqB4ySxEWePYOJC/vZq/ Xrc28kqrnAsRp1dCgmtkdz2f5MhOnogFDul2rYcWD/LFXcTiDozbrRY5ZW4BhkBB2Sbb //Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709578050; x=1710182850; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bPWx/2YJ6inT4AzN3TSSoDvg/VeRAtNCqChMNNUNVpE=; b=UyNvuLTN24MPX2rd8FxGjSlRoNs4tvG8XVj4oLPTNHphYAriSz59IzbRDdT8P0xzTe Kfl8hQhHYeegyDhSMKbybJmQzxywsVkPg+suqdzDDBWFGWMgdWPlhNLenzhULT8XnNV+ Co+G+dC7V6SLY6S8qJrTRiyq36iSlNVVgZ9Jh10spH6iN158bw7xRq7RWHlMPxYxymbf ivyeZ0tSIK5dmZf9Tx4hg0g+i65zwpaEAzJy5fqJN00xZNZbkqWAhzI+pHBNZUjp4soV ArckX/VNesmwuQWx513quxI6o428x2dvIAgTkotvjgG/pazG8BidDHTEUXqmgxX6afVb QuZg== X-Forwarded-Encrypted: i=1; AJvYcCW2l4O7IxC1ncgiWo7ya6tdKR/Lj0A1A7w+g10iwjHh1N7K76jGdwGSyc1s79haL4exSh78UxocNDi3IdHpPV9Vy7c288ZfyS0= X-Gm-Message-State: AOJu0YzipOAQbnDmPcw5SfHTsSXxnr8x9nAuVmbZ0pxXZAWx6FkFANx8 xKvx2V6w0hIxuUopiPMjWfoEGTmNJ3un2bZlzXruk2BgXH8S6DbMp5ZLHNejTOU= X-Google-Smtp-Source: AGHT+IEVFpoEYR8NBxB7+N45g8j3I5AbpYE2sFJLV9ksAs8/asuxF7UkVeaUHHMb/0mo3aKN4E2UyA== X-Received: by 2002:a17:902:fc8f:b0:1dc:f7c2:938e with SMTP id mf15-20020a170902fc8f00b001dcf7c2938emr10319366plb.38.1709578050038; Mon, 04 Mar 2024 10:47:30 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c1:ec17:6807:fa0e:d54a:aeda? ([2804:1b3:a7c1:ec17:6807:fa0e:d54a:aeda]) by smtp.gmail.com with ESMTPSA id a21-20020a170902ee9500b001db5753e8b8sm8829539pld.218.2024.03.04.10.47.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Mar 2024 10:47:29 -0800 (PST) Message-ID: Date: Mon, 4 Mar 2024 15:47:26 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: logb() vs floor(log2()) Content-Language: en-US To: Alejandro Colomar , Morten Welinder Cc: linux-man@vger.kernel.org, libc-help@sourceware.org References: From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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?