From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 29AA1385703D for ; Mon, 18 Sep 2023 11:37:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29AA1385703D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695037067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HUTLHhfh3rL0g1OJ+jUebCRMxOY87uqueCF3+A4/x3Y=; b=TPjfa1WdLkicpTIw3uEqZJJXzTGdtP4QPV0VrcmFMUZBsJuA7DO//1LIwCHI+Kt1/26bRh PExpkkog7OR0Q1jMYkilXdLgUGFYIKD+YcTBwsFzz4rJL0pvjg6fIO7cmIodr96ic5WlRI 2UkeLScO8dzU8jA/egYRzxPxOlCIj+0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-696-p6fDJUTkMACaQia7WOUzMQ-1; Mon, 18 Sep 2023 07:37:46 -0400 X-MC-Unique: p6fDJUTkMACaQia7WOUzMQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2217B801FA9; Mon, 18 Sep 2023 11:37:46 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 096522156711; Mon, 18 Sep 2023 11:37:44 +0000 (UTC) From: Florian Weimer To: Richard Biener Cc: Alexander Monakov , gcc@gcc.gnu.org Subject: Re: Concerns regarding the -ffp-contract=fast default References: <87r0n01z18.fsf@oldenburg3.str.redhat.com> <21e46cef-1fbf-df87-608d-52b7f894dea7@ispras.ru> <877condc69.fsf@oldenburg.str.redhat.com> Date: Mon, 18 Sep 2023 13:37:43 +0200 In-Reply-To: (Richard Biener's message of "Mon, 18 Sep 2023 12:37:43 +0200") Message-ID: <87wmwnbtko.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: * Richard Biener: >> How much numerical code is compatible with that? For example, David >> Goldberg's What Every Computer Scientist Should Know About >> Floating-Point Arithmetic (revised) contains this sentence: >> >> | A language definition that does not require parentheses to be honored >> | is useless for floating-point calculations. >> >> > > I suppose that applies to re-association not honoring parens. With C > you either have no re-association (fine) or re-association but globally, > at the expense of violating the standard. FP contraction is _not_ > about honoring parens, the 'error' introduced by is subtle. But for contracted expressions, + *is* associative. Maybe this is not the most relevant part of the article for contractions, though. > Fortran for example allows re-association by default, but honors > parens. GCC can do this just fine. I think it's still a divergence from the model promoted by the article. For further problems see =E2=80=9CPitfalls in Computations on Extended-Base= d Systems=E2=80=9D; that covers the matter of excess precision (which, as far= as I understand, is very relevant to contractions). It quotes this code snippet: | if (1.0 + x .eq. 1.0) then The C11 standard does not define what =E2=80=9Cfloating expressions=E2=80= =9D are (as far as I can see), so it's a bit unclear whether the whole thing can be contracted (assuming x is not a NaN). Thanks, Florian