From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CF6743858D33; Tue, 28 Feb 2023 17:23:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF6743858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677604996; bh=OEkPAPSRct3AAgornPtBS8cdhNc5ZOWvoMIS4mDjAz4=; h=From:To:Subject:Date:From; b=DZyIm9b1cgRq6kUwAtoyN10hCbt2kQeKAibfQY5G+ycxHze60W1gxOBknQhIyqfNm CbDBoSOb//7pt0pkV733GAUsKSzWcM5toOt/IiLpo9QgGNuUwH8RDg5v+2J33DoCpZ /9zMEuPQKwJuvTlWsGSd2O54OjkEa6+aMGo4UyHE= From: "marcus at mc dot pp.se" To: glibc-bugs@sourceware.org Subject: [Bug math/30181] New: Imprecise result from asinhl on IBM 128-bit long double Date: Tue, 28 Feb 2023 17:23:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: math X-Bugzilla-Version: 2.36 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marcus at mc dot pp.se 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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=3D30181 Bug ID: 30181 Summary: Imprecise result from asinhl on IBM 128-bit long double Product: glibc Version: 2.36 Status: UNCONFIRMED Severity: normal Priority: P2 Component: math Assignee: unassigned at sourceware dot org Reporter: marcus at mc dot pp.se Target Milestone: --- Created attachment 14723 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D14723&action=3Ded= it Patch to fix precision loss in sysdeps/ieee754/ldbl-128ibm/s_asinhl.c When running the following program on ppc64 with IBM long double ABI: ---8<--- #include #include int main(int argc, char *argv[]) { long double x =3D 13.7L; printf("Expected : 3.31187234356338694815\n"); printf("Function : %.20Lf\n", asinhl(x)); printf("Definition: %.20Lf\n", logl(sqrtl(x*x+1.0L)+x)); return 0; } ---8<--- the result is: ---8<--- hakua:~% /tmp/asinhl_test Expected : 3.31187234356338694815 Function : 3.31187234356338689639 Definition: 3.31187234356338694815 hakua:~%=20 ---8<--- Note that the last 4 digits printed are wrong when using the asinhl functio= n, but correct when using the definition of asinh. The error is because the implementation uses fabs instead of fabsl in one place, causing the loss of precision. After changing the call to fabs into a call to fabsl, the program works correctly: ---8<--- hakua:~% /tmp/asinhl_test Expected : 3.31187234356338694815 Function : 3.31187234356338694815 Definition: 3.31187234356338694815 hakua:~%=20 ---8<--- I'm attaching the patch. --=20 You are receiving this mail because: You are on the CC list for the bug.=