From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D1DA33857BB3; Mon, 24 Oct 2022 20:51:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D1DA33857BB3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666644711; bh=fDf6qVXdbVlv/+r4BwMEXAtcT5yKG+9kbT1X6+8hPKU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vLMAMflE6CP8Y8Q1IPakOYg/yvqPFaQpeJ6AEA0iTidoWv3O4qyqHp3BOHQnTs6L+ puYUwT9XifelI5Jf08qZ1vzkdnJ5W4B+qEmJ/RhF5l2EEZj0xMYEqdAWNlNc1DjTu5 VELoDfBnZqOghCslj4v+UqqYEbdnIhLk0zaWeBGk= From: "jacob at jacob dot remcomp.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107370] long double sqrtl constant folding is wrong Date: Mon, 24 Oct 2022 20:51:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 10.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jacob at jacob dot remcomp.fr X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.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://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107370 --- Comment #16 from jacob navia --- Sorry but the program I used was compiled with gcc. It suffers from lack of precision too. In ANY case, in decimal now, the square root of 2 is 1.414 213 562 373 095 048 801 688 724 209 698 078 GP PARI calculator 1.414 213 562 373 095 145 547 462 185 874 gcc: only the first 15 digits are= OK ^^^^^=20 In ANOTHER example: #include #include int main(void) { printf("%.30Lg \n",sqrtl(powl(2,225))); } This produces: 7.34301663720716943338259962711e+33 But bc produces=20 ~/lcc/book/test % bc bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'.=20 scale=3D32 sqrt(2^225) 7343016637207168931428032607349397.48923080385562326502615381523522 To make things clearer I put now the results side by side 7.34301663720716943338259962711e+33 gcc 734301663720716 8931428032607349397.48923080385562326502615381523522 bc As you can see, after the 15th digits all others are wrong!!! Jacob=