jerpelea opened a new pull request, #21258: URL: https://github.com/apache/nuttx/pull/21258
## Summary frexp() computed the exponent as ceil(log2(x)) and divided by ldexp(1.0, exponent): - for a power of two, it returned a mantissa of 1, not 0.5; - for a negative number, zero or a subnormal, log2() gave NaN or -inf, and the conversion to int gave a wrong exponent; - ldexp() was x * pow(2.0, n), which is not exact and overflows when 2^n is out of range but the result is not. gnulib's printf replacement checks the frexp() result and calls abort(): coreutils sleep and printf exited with status 1 for any number, and seq printed nothing for a fractional step. Take the exponent from the IEEE bits in frexp() and frexpf(), scale by powers of two in frexpl(), and use scalbn() in ldexp(). The results are the same as glibc for 2 million random values, the special values and subnormals. ## Impact RELEASE ## Testing CI -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
