When I run this code on a CentOS 7 image, I get an incorrect result.
#include <iostream>
#include <cmath>
#include <iomanip>
int main() {
long double num1 = 20010999999.9999990905052982270717621L;
std::cout << std::fixed << std::setprecision(20) << "std::round(" << num1 << ") = " << std::round(num1) << std::endl;
return 0;
}
// (centos7): std::round(20010999999.99999909050529822707) = 20010999999.999999090505298227
I found that this task should be associated with the roundl function in libm.so.6. After modifying this function as follows, the code runs correctly.
-cmp w19, #0x1e
+cmp w19, #0x2f
Could this modification be incorporated into the CentOS 7.9 image?
When I run this code on a CentOS 7 image, I get an incorrect result.
I found that this task should be associated with the roundl function in libm.so.6. After modifying this function as follows, the code runs correctly.
Could this modification be incorporated into the CentOS 7.9 image?