From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E6CC73858D28; Mon, 4 Mar 2024 15:35:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E6CC73858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1709566525; bh=/eoku1VunGVhAtvV7kqhMoKVW+OJOopUiPM9Nis9xds=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QTLr5M5CCz1geeD1dy9itOQbulNN2Hc5m+wwyApRvNJVRgL5L+SjFghxpaQWZdGcx RIGZ59n01FPHPNJjWv6F6zNW/8+03S7wADMJjYcwVSVAPRvk6FJ98UeVAjmD/mVFb1 NMgHfAy/kQ3K3y8fo9y5gy1ZKTW5szGLCupRELP0= From: "vincent-srcware at vinc17 dot net" To: glibc-bugs@sourceware.org Subject: [Bug math/28472] pow(10, i) accuracy Date: Mon, 04 Mar 2024 15:35:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: math X-Bugzilla-Version: 2.31 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vincent-srcware at vinc17 dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D28472 --- Comment #16 from Vincent Lef=C3=A8vre --- (In reply to Wilco from comment #15) > GLIBC double precision pow is the most accurate of all libraries tested at > 0.523 ULP [1]. What you forget is that this is the accuracy *tested* on arbitrary values. = The actual accuracy may be worse. And this is the case here, with an accuracy larger than 1 ulp, according to the results in Comment #6! > The new exp10 is also the most accurate of the 13 tested math libraries. >=20 > If you complain about inaccuracies in the most accurate library then maybe > your expectations are a little bit off... In the present case, it may be far worse than the most accurate libraries (well, it is difficult to say, due to the random tests). The result returne= d by glibc is not even faithfully rounded. So the user is right to complain, even though there is no guarantee from the ISO C standard. > The fact is, binary floating point cannot represent all powers of 10. If = you > don't like the rounding behaviour of floating point, don't use floating > point. Don't blame floating point if this is a poor implementation. > Note compilers optimize pow (C, x) into exp (x * log (C)) with -Ofast. > However if C is a multiple of 2 or 10, we could use exp2 or exp10 for > slightly better accuracy. I suppose that you mean "if C is a *power* of 2 or 10". --=20 You are receiving this mail because: You are on the CC list for the bug.=