On Fri, Nov 4, 2022 at 8:14 PM Jakub Jelinek wrote: > > On Mon, Oct 17, 2022 at 08:21:01AM +0200, Aldy Hernandez wrote: > > +// Set VALUE to its next real value, or INF if the operation overflows. > > + > > +inline void > > +frange_nextafter (enum machine_mode mode, > > + REAL_VALUE_TYPE &value, > > + const REAL_VALUE_TYPE &inf) > > +{ > > + const real_format *fmt = REAL_MODE_FORMAT (mode); > > + REAL_VALUE_TYPE tmp; > > + bool overflow = real_nextafter (&tmp, fmt, &value, &inf); > > + if (overflow) > > + value = inf; > > + else > > + value = tmp; > > Please change the above 5 lines to just > real_nextafter (&tmp, fmt, &value, &inf); > value = tmp; Done. As suggested upthread, I have also adjusted update_nan_sign() to drop the NAN sign to VARYING if both operands are NAN. As an optimization I keep the sign if both operands are NAN and have the same sign. How's this? Tested on x86-64 Linux. LAPACK testing as well. Aldy