Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found a bug in libm.so.6 in centos7.9.2009 image #201

Open
aqluheng opened this issue Jul 11, 2024 · 0 comments
Open

Found a bug in libm.so.6 in centos7.9.2009 image #201

aqluheng opened this issue Jul 11, 2024 · 0 comments

Comments

@aqluheng
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant