From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DCA2D385840C; Mon, 24 Oct 2022 21:02:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DCA2D385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666645353; bh=7EW3Z9yITXji9x8c/L9flw7qYrTiONcpLzMplCRDb4U=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uOIOocq/aBPyld4Qb6292rNSAb1ga3jndOzDmZIH1FtXutdLzPwh3LrXgvB71I0KI buaWCX+oL79uegTxcAsJT+LI23iONQv9XNy7vz+uRBoJxksyMPsoJYgcW6lfU1ZlOk FCxzWWoPVzkAjX3P5n8ZJ/fxIGqp9/joXrn9KkzA= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107370] long double sqrtl constant folding is wrong Date: Mon, 24 Oct 2022 21:02:33 +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: jakub at gcc dot gnu.org 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 #20 from Jakub Jelinek --- All I'm arguing is that everything I see from gcc seems to be correct. 30 digits precision is not enough for IEEE quad, 36 is enough. If I try your sqrt (2^255) case on x86_64, I see: #define _GNU_SOURCE #include #include #include int main () { volatile _Float128 x =3D __builtin_sqrtf128(powf128(2, 225)); char buf[256]; strfromf128 (buf, 128, "%a", x); strfromf128 (buf + 128, 128, "%.36f", x); printf ("%s\t%s\n", buf, buf + 128); x =3D x * x; strfromf128 (buf, 128, "%a", x); strfromf128 (buf + 128, 128, "%.36f", x); printf ("%s\t%s\n", buf, buf + 128); } 0x1.6a09e667f3bcc908b2fb1366ea95p+112=20=20 7343016637207168931428032607349397.000000000000000000000000000000000000 0x1.ffffffffffffffffffffffffffffp+224=20=20 53919893334301279589334030174039256154977430310253516431710891278336.000000= 000000000000000000000000000000 so again, x * x is 1ulp from 0x1.0p+225.=