From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 0CC9C393FC3F for ; Tue, 17 Mar 2020 22:24:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0CC9C393FC3F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joseph_myers@mentor.com IronPort-SDR: rOT1j2k+8+pEXWMNJq1DLgQEgGoM1HR0Zb1n95uUAPsu4USnLuw6ReffVfGeDXc1UE4DMS5FG8 a5JbC0UW0PFUlMQQjBHLwTgnWdcF1pWhB+NdlPCkh75bLQWM9ipOtoX4VWzGm3h6u+ESGQ/T3a C7MLf9Ix2bYy/35gNIif+vd9sG6H9neU3IPMDrdR0+KiRNDU+Gpf0VsKiX1VR2xFKJi2yn3Ycy +3zI6A2i8fO47c8y+ymALBPqslIzhKdYv7enMc2SfouR7a0kF8c3wXzK7+EpJolGQKqr+eO53k Afk= X-IronPort-AV: E=Sophos;i="5.70,565,1574150400"; d="scan'208";a="46756103" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 17 Mar 2020 14:24:13 -0800 IronPort-SDR: 3rg8sMowwxyJXePkPSlwg1Mr0eK3TIy6/JpczPxAmexUX05orzqKD7UMrFxMjbSJZI8mX4GLjm u901r8SPTBeV3MWvKVbf8t2DHhG85/R7ZASomu9zKqr1neIPsjlmXiEvDqVVecE9v5yumLlhYX +6qzPgZ6Ns4ukv4cr/9N9U5Ya3yENBs5USyEWgQNlUQbTGV1WEfs3AZCv0pcrqI93m7PRKQHMJ Bp/pFR+5liCJuuHqS0rt7HOv8liLc16DEs8MxSj1WO2YnJIz2X33Mci0SndTO7Q02y3Iy0ZBBd bTc= Date: Tue, 17 Mar 2020 22:24:07 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Keith Packard CC: , Fabian Schriever Subject: Re: [PATCH] Fix truncf for sNaN input In-Reply-To: <87o8svmxtg.fsf@keithp.com> Message-ID: References: <20200311095805.582-1-fabian.schriever@gtd-gmbh.de> <87zhcmr52d.fsf@keithp.com> <87sgieqzub.fsf@keithp.com> <87wo7km63l.fsf@keithp.com> <87o8svmxtg.fsf@keithp.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) X-Spam-Status: No, score=0.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2020 22:24:15 -0000 On Mon, 16 Mar 2020, Keith Packard via Newlib wrote: > Joseph Myers writes: > > > I don't think POSIX specifications should be trusted for how functions > > should behave with sNaN inputs. Rather, prefer the specifications from TS > > 18661-1 (or the latest C2x draft which has TS 18661-1 integrated). > > From my reading of that, I should only check for signaling vs quiet NaN, > ensuring that values are the right kind of NaN, but not any specific > value of NaN. > > I've adjusted the newlib tests like this: > > /* All signaling nans are the "same", as are all quiet nans */ > if (isnan(correct.value) && isnan(is) > && (issignaling(correct.value) == issignaling(is))) > { > /* PASS */ > } > > Does this seem correct? Yes. Only a few functions such as fabs and copysign are expected to preserve NaN payloads (and those functions also preserve whether the NaN is signaling and never raise exceptions). -- Joseph S. Myers joseph@codesourcery.com