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

musl libc-test report 77 bugs #236

Open
augustin-cheron opened this issue Jan 25, 2020 · 4 comments
Open

musl libc-test report 77 bugs #236

augustin-cheron opened this issue Jan 25, 2020 · 4 comments

Comments

@augustin-cheron
Copy link

augustin-cheron commented Jan 25, 2020

As an exercise, I have exposed rust-lang/libm as a c library and linked it against musl test suite libc-test
It founded 77 bugs excluding all bug related to wrong error handling and long double.
The bugs are located in : acosh, asinh, j0, jn, jnf, lgamma, sinh, tgamma, y0, y0f, ynf.
All the code can be found on this branch.
You can run the test using the test-musl.sh script.

I'm not sure how to proceed. Should we expose a c abi library and linking it with other libm test suite or port all the test as rust unit test ?

@alexcrichton
Copy link
Member

Thanks for the report! I think there's always room for a bit more CI in a repo like this.

Could you elaborate a bit on the bugs you're finding? Are these bugs that need fixing in the source code? Or are these sort of like 'interface bugs' where this library doesn't do things like set errno?

@augustin-cheron
Copy link
Author

Sorry I did not link the gist with the filtered report :
https://gist.github.com/augustin-cheron/34e836b81da8a7f917e473257adad4a0

The original report is 6k lines of error mostly due to not setting errno and failing on all the test related to long double functions.

After filtering those out it still reports 77 bugs that may need fixing in the source code.
I did not check all of them but they are mainly precision errors.

The first bug on acosh
X src/math/special/acosh.h:9: RN acosh(0x1.001f1c62cf304p+0) want 0x1.f8d125ff71ccp-6 got 0x1.f8d125ff71cc2p-6 ulperr 1.853 = 0x1p+1 + -0x1.2d785ap-3
with

0x1.001f1c62cf304p+0  = 1.000474714396831
0x1.f8d125ff71ccp-6   = 0.030811583621269234 // want
0x1.f8d125ff71cc2p-6  = 0.03081158362126924   // got
wolframe aplha give     0.0308115836212656416...

The third bug for j0
X src/math/special/j0.h:9: RN j0(0x1.33d152e971b4p+1) want -0x1.19b7921f03c8ep-54 got -0x1.00209921727cbp-54 ulperr 450179413049344.000 = 0x1.996f9p+48 + 0x1.ece5dp-5v

0x1.33d152e971b4p+1     =  2.404825557695773`
-0x1.19b7921f03c8ep-54  = -0.0000000000000000610876525973673 // want`
-0x1.00209921727cbp-54  = -0.00000000000000005553876295239997 // got`

@alexcrichton
Copy link
Member

Ah ok, makes sense! I think it'd be great to fix these accuracy bugs for sure, and if we could include the test script that'd be great too!

For the errno stuff I think we'll want to basically ignore that for now, I don't think this library will want to explore an ABI-compatible solution in that respect.

@augustin-cheron
Copy link
Author

I have pushed every thing in PR #237.
Their is a lot of code, and I don't really see how this can be integrated with current CI.
It may be easier to keep the content of PR #237 as a way to check for new bugs and duplicate all the failing test in their corresponding rust file.

What I have in mind is a process like this:

  1. find a new test suite for libm
  2. integrate the test as script in libm-c-abi
  3. extract failing test and recode them as rust unit test
  4. once in a while run all the test script to check for new bugs

If every one is ok with that I don't mind submitting a PR adding the 77 failing test as uni-test.

As for fixing the accuracy bugs, I'm not sure where to start my current plan is to build two version of the same software, one using musl, the other one using rust-libm and debug them step by step.

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

2 participants