From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1EC423858C5E; Wed, 28 Feb 2024 00:59:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1EC423858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709081967; bh=RwNlnQ84yQeb/08KhLWX+IvOhi1Gjpr/XHFgxqDczE4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sNbE0BrYPUhPgOF6NWcmSVfZoD6j/9fAoKctFq3omelvXF0OrF8BXCwUq0hQofV3S v3iMn6Q56aAGGlu7Nsfi3Hf1YMe3fkNVi7RoSa5qbzpbnki0acCAKYGS219XcQ3/Z3 hS3W9GAsF+ltfZi/xNnAoI9zxBFSI86EasNAwrwA= From: "g.peterhoff@t-online.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/114140] different results for std::fmin/std::fmax and quadmath fminq/fmaxq if one argument=signaling_NaN Date: Wed, 28 Feb 2024 00:59:26 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: g.peterhoff@t-online.de 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 #7 from g.peterhoff@t-online.de --- I think there is a misunderstanding. The problem is that std::fmin/std::fmax and quadmath fminq/fmaxq give different results when only *one* argument is signaling_NaN. The standard (https://en.cppreference.com/w/cpp/numeric/math/fmin + https://en.cppreference.com/w/cpp/numeric/math/fmax) says: * If one of the two arguments is NaN, the value of the other argument is returned * Only if both arguments are NaN, NaN is returned quadmath fminq/fmaxq also return NaN if only *one* argument is signaling_Na= N.=