[PATCH] Don't call double rint from float powf.
Jim Wilson
jimw@sifive.com
Tue Dec 12 18:05:00 GMT 2017
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
More information about the Newlib
mailing list