This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Don't call double rint from float powf.


On 12/11/2017 04:37 PM, Craig Howland wrote:
On 12/11/2017 07:08 PM, Jim Wilson wrote:
-               if(x<0.0&&rint(y)!=y) exc.retval = -HUGE_VAL;
+               if(x<0.0&&rintf(y)!=y) exc.retval = -HUGE_VAL;
              }
              if (_LIB_VERSION == _POSIX_)
                  errno = ERANGE;
To be most rigorous, "0.0" on the same lines as the rintf() should be "0.0F" (as otherwise the comparison strictly should be done in double). (Not addressing the exact change you are making, but is the same class of fix and are on the same line of source code.)

Any reasonable compiler will get this right. GCC does a float compare here even if you compile without optimization. So no fix here is required, though I can redo the patch if you want.

Jim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]