From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by sourceware.org (Postfix) with ESMTPS id AA8663858C60 for ; Mon, 18 Sep 2023 11:55:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AA8663858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ispras.ru Received: from [10.10.3.121] (unknown [10.10.3.121]) by mail.ispras.ru (Postfix) with ESMTPS id 5D2CD40F1DF9; Mon, 18 Sep 2023 11:55:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 5D2CD40F1DF9 Date: Mon, 18 Sep 2023 14:55:09 +0300 (MSK) From: Alexander Monakov To: Florian Weimer cc: gcc@gcc.gnu.org Subject: Re: Concerns regarding the -ffp-contract=fast default In-Reply-To: <87y1h3btqm.fsf@oldenburg.str.redhat.com> Message-ID: References: <87r0n01z18.fsf@oldenburg3.str.redhat.com> <21e46cef-1fbf-df87-608d-52b7f894dea7@ispras.ru> <877condc69.fsf@oldenburg.str.redhat.com> <87y1h3btqm.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, 18 Sep 2023, Florian Weimer via Gcc wrote: > But the contraction would still be valid after an isfinite check > (something that ranger might catch these days), or with with > -ffinite-math-only in general. Right? Nope, still not valid for negative zero ('x + x - x' would yield positive zero in the default rounding mode). > > Contracting 'x + x - x' to fma(x, 2, -x) would be fine. > > It still changes the result, doesn't it? I don't follow. I doesn't change the result for infinities (produces a NaN). It changes the result when x is so large that 'x + x' is not representable (exponent would overflow), but that's exactly what contraction is about? Alexander