From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 1017C3857030 for ; Thu, 3 Sep 2020 17:03:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1017C3857030 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: ukM+Kn8U1Bblz7PFumjsY2AgixaqbKgdacCgNQrZXZ9RjWBM+4yrYGEYBInvjYUCj4p3bPg7eN dcOZquWrZR4U3KpzjPdrwiRAfspDeLl5cDr9dAh4fem3BpMVKkdworJtn+pso7PqMcly1thRvE vpraeUbi8SmKkR6BpCmvD4RUjatP79491+wf8MID1P5hoSsVdIyOoERTn/zYxDExwkRmCNWgEt 7iQ1BEgc2SzexwW1ot/qbFsxEtct9IRSO/2mzEO7EqlDDDu71wFv3vm1Lxc3EC7+5kk8CsIYIA m+0= X-IronPort-AV: E=Sophos;i="5.76,387,1592899200"; d="scan'208";a="52540677" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 03 Sep 2020 09:03:12 -0800 IronPort-SDR: I5NVOb6cSLi8bLMRlbXv7YCorKeHHJVbJ7Oz1nXouYE8HF+sFZx+su8TMyFcBF0C1ixAa+Y9zm 1qtni5P4PE9QJKpI8wv90tqFr5CPEyaweGK4GzkLpQYRomNG6JDXlaU3nsEll0kxCPDCtACeMs FKlGEiHzvH3o0HOJF9Yu1Z4dxsgqyXQudd9+Aiy0hdiGEb1zRLTzKUknAQVcMFhwpX/cSo/9H6 eK114joKtXuYSR8FzisUnCDtvmksx2lEu4Nhv90hAzRGC2e/yX3YPkByp25ZdeGq3iijsdkKB4 xFg= Date: Thu, 3 Sep 2020 17:03:08 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Ruinland ChuanTzu Tsai CC: , Subject: Re: In libm, sin(qNaN) doesn't expect FE_INVALID ? In-Reply-To: <20200903123442.GA5266@APC301.andestech.com> Message-ID: References: <20200903123442.GA5266@APC301.andestech.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-03.mgc.mentorg.com (139.181.222.3) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) X-Spam-Status: No, score=-3127.5 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2020 17:03:14 -0000 On Thu, 3 Sep 2020, Ruinland ChuanTzu Tsai wrote: > Hi all, > sorry for the bothering. > > Recently, as I'm testing some modification on libm, I happen to realize > the fact that glibc's testsutie doesn't expect sin(+-qNaN) to trigger > FE_INVALID, which is designed in `math/libm-test-sin.inc` : See subclause 6.2 of IEEE 754: "Every general-computational and quiet-computational operation involving one or more input NaNs, none of them signaling, shall signal no exception, except fusedMultiplyAdd might signal the invalid operation exception (see 7.2).". The special rule about fma(0, Inf, qNaN) (where the standard leaves unspecified whether the NaN operand takes precedence over the multiplication 0 * Inf that would raise "invalid" if not fused with an addition) is handled through INVALID_EXCEPTION_OK in libm-test-fma.inc. The cases of INVALID_EXCEPTION_OK for various complex functions are where Annex G in the C standard mentions an optional "invalid" exception, and those for the significand function are empirical, reflecting that that function is not part of any standard. No function from any standard should be using INVALID_EXCEPTION_OK in the testsuite without explicit standard wording about such an exception being permitted but optional. Note that conversions from floating-point formats to *integer* formats signal "invalid" for quiet NaN inputs, since the NaN can't be represented in the output format. Likewise, some but not all comparison operations signal "invalid" for quiet NaN arguments (see subclause 5.8 of IEEE 754). -- Joseph S. Myers joseph@codesourcery.com