From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EAB373858D37; Wed, 28 Feb 2024 02:00:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAB373858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709085626; bh=RTSkAF+KtKSxOnSdhrajdevBPE5Z9SKr/t5AAjePKJU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fidb286sWsf5is9lwzUo28B/6VUkJc5XVmPu/7q3YWYpMIpmCnuLMloSzUjY6ZtrQ U3jFg2o5Bg7AxxlPqfpaqC93/ohui27EsM8x/0e9UuP9MsR9a2Nj5qTxDLDvTpgUsp eMVKVET/Iw0vVcoSkos0b01PEyAt3h7FMtlmHuBo= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libquadmath/114140] different results for std::fmin/std::fmax and quadmath fminq/fmaxq if one argument=signaling_NaN Date: Wed, 28 Feb 2024 02:00:26 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libquadmath X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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=3D114140 --- Comment #14 from Andrew Pinski --- (In reply to g.peterhoff from comment #13) > > The cppreference page is wrong. > But then *all* of your implementations for fmin/fmax (float, double, long > double, std::floatN_t) would be wrong, because they give exactly the resu= lts > as described on cppreference. > Is this really the case (which I don't believe)? And if so, that still > doesn't solve the original problem: std::math-functions and > quadmath-functions *must* of course return the same results - no matter > which implementation is correct. Again read what I mentioned, adding -fsignaling-nans changes the behavior of std::fmin/fmax even for float/double,etc. As I mentioned, it is about constant folding of fmin (inside the compiler) = vs what the function actually does. > Is this really the case (which I don't believe)?=20 You can test it yourself by changing const to volatile and you will see it = is different in the middle-end's constant folding vs libc's version. libc (and libquadmath) version is correct based on those 2 sourceware issue= s. The question becomes is the constant folding version correct without -fsignaling-nans ?=