From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 856063858C2F for ; Mon, 15 Aug 2022 21:00:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 856063858C2F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,239,1654588800"; d="scan'208";a="81342818" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 15 Aug 2022 13:00:03 -0800 IronPort-SDR: IYlc8yNN8jWMzPbMEiEpfKmJayMb8P2CM45cCdcZ5N78CTGqU7zWqDKSxkg0sukT8xYK2LIjLD aPWVjCQpXq7LZkuR+c10BZPMbFw85LSGZtSDeQJgMYRJUbCu4hfWqepk/O808iR7FgJM2+ziY3 iK8sa5olij+Bd0Ema35smLcjRMbrWz74Yzy53f2gYDCHhFl1yVowHuxVoRDXdaeYvXSAnMFqhw ljOl2pCSXpWXfnpIaXN5JOn6d6PgjrLAdOH7AWINgaaCsb99liCWMpW25KkHFDaO6LGC3njrCu pm4= Date: Mon, 15 Aug 2022 20:59:53 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Wilco Dijkstra CC: "michael.hudson@canonical.com" , 'GNU C Library' Subject: Re: [PATCH] Ensure calculations happen with desired rounding mode in y1lf128 In-Reply-To: Message-ID: References: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3111.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_NUMSUBJECT, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Mon, 15 Aug 2022 21:00:05 -0000 On Fri, 12 Aug 2022, Wilco Dijkstra via Libc-alpha wrote: > All math functions using the SET_RESTORE_ROUND macros will need similar > barriers. Note that it is feasible to remove these macros altogether and fix > any issues (a slightly larger ULP is acceptable for non-nearest rounding). > Given rounding mode changes are generally expensive, this also improves > performance (though that may not be important for 128-bit floats). This one is a case where SET_RESTORE_ROUND is used to reduce error accumulation to keep the errors within the bounds accepted by the testsuite (see bug 16824). In such cases, it may indeed be possible to change the algorithm to one that has less total error accumulation possible in any rounding mode so the results are sufficiently accurate independent of rounding mode without needing SET_RESTORE_ROUND. In other cases, the manipulation of the floating-point environment is needed for correctness, e.g. to avoid spurious exceptions or to implement round-to-odd for functions that must be correctly rounding, or it's because algorithms for higher internal precision are used (Dekker / Knuth) that are only correct in round-to-nearest most and much larger errors might occur if those are used in the wrong rounding mode. -- Joseph S. Myers joseph@codesourcery.com