From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C71F33858D32; Tue, 20 Jun 2023 15:18:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C71F33858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687274284; bh=GM0adpsNpakSo62sPwnTzi80HmG3HjTBYofWVECkZhw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZThvQDQXiUUjuEfobdoOmSqUj1KQ0uUDVCaXDVbMwTJ0R9oeb7qMnR4FHfb2ScpJL 1nB0hDc4aPRl8GtyJ73yEIwmi5whPPP7GYIPltHJI9JSGzXkX9ZMQXjo1u3psulVhp f5cU1Gj4a9olMVrwW+/03lZd2N5l6VQI0uBE67g8= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110321] Double precision comaprison does not seem to work well when -std=c++17 option is selected Date: Tue, 20 Jun 2023 15:18:04 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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=3D110321 --- Comment #1 from Jonathan Wakely --- As described in the manual, sincve GCC 13.1 -fexcess-precision=3Dstandard is enabled by -std=3Dc++NN (but not by -std=3Dgnu++NN). This means the literal 2.2 is represented with excess precision, and so is = not equal to the same value converted to double. You can use (a =3D=3D (double)2.2) to make the comparison work.=