From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6D75A3858C66; Tue, 7 Mar 2023 13:29:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D75A3858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678195761; bh=LH3mkiYQ7jJtKw+Mi7uVOmUngcEiltVI/AHb8Ynu4q4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aQFRehxqQ1rksXYZmwy/7bI+NP1kscgym0ZLUL6onifo1w8a180fLdQeaQk+kPhMP UqSmguwJCZ1z5hY3Jz0A9FVimVt+keD6+w+e+rLLMiYhQe1j2olB2GvPOo0f2JDzsB W+RjZCOm7IxtrqQlpoCdl3A3sgzgVXm2q0sXb+rY= 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:29:21 +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 #20 from Richard Biener --- (In reply to Richard Biener from comment #19) > I still think we should avoid iteration. Looking at plus we have >=20 > x =3D y + a >=20 > which is actually >=20 > x =3D y + a +- 0.5ulp (y + a) >=20 > (0.5ulp of the y + a result), so we can compute a as >=20 > a =3D x - y +- 0.5ulp (y + a) >=20 > 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 ha= ve > 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. >=20 >=20 > For multiplication it's >=20 > x =3D y * a +- 0.5ulp (y * a) >=20 > a =3D (x +- 0.5ulp (y * a)) / y >=20 > so it's again similar. >=20 > 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? So in principle REAL_VALUE_TYPE would support adjusting by half an ulp, we just cannot use real_nextafter for that but we'd have to do this manually somehow and the real_convert after could in principle also do the -+INF rounding (but that's not implemented yet).=