From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A61A43858C39; Tue, 7 Mar 2023 13:18:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A61A43858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678195129; bh=1X6cXs3ZY6JTbkZktDp/OH95o/8+X7kGx75WwyfZEe0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OVBmRHu/AHdHHUjfSTuJIEL+ycN7sDzu53MbN6jbC/jLgouAt5ijTkZB/PQ+dqqKx 2rUpmQWy6/dFTLUBbuHM156ltQt7ilKaHjHKGJXYodMPs0qWafXqcalbh+TRcXpXp+ HEMT5QAJl6AInrODApgtDLz7KRXWSWbjtHY1eYrA= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109008] [13 Regression] Wrong code in scipy package since r13-3926-gd4c2f1d376da6f Date: Tue, 07 Mar 2023 13:18:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109008 --- Comment #19 from Richard Biener --- I still think we should avoid iteration. Looking at plus we have x =3D y + a which is actually x =3D y + a +- 0.5ulp (y + a) (0.5ulp of the y + a result), so we can compute a as a =3D x - y +- 0.5ulp (y + a) note 0.5ulp (y + a) isn't 0.5ulp (x), not exactly at least, so we have to approximate it and a conservative bound is 1ulp (x) here. We may also have to make sure to round toward -Inf for the lower bound of the result range and +Inf of the upper bound of the result range I think. For multiplication it's x =3D y * a +- 0.5ulp (y * a) a =3D (x +- 0.5ulp (y * a)) / y so it's again similar. So what we can indeed do is widen the LHS range by 0.5 ulp and since we cannot represent that and it might be imprecise if 1 ulp _after_ the rounding is smaller than 1 ulp _before_ the rounding operation we simply use 1 ulp widening of the LHS?=