https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109008
--- Comment #20 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #19) > I still think we should avoid iteration. Looking at plus we have > > x = y + a > > which is actually > > x = y + a +- 0.5ulp (y + a) > > (0.5ulp of the y + a result), so we can compute a as > > a = 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 = y * a +- 0.5ulp (y * a) > > a = (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? 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).