Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Conversation

@quaternic
Copy link
Contributor

When porting sincosf from musl, the double-precision constants used for range reduction were mistakenly (I assume) cast to f32, which led to inaccurate results in some cases.

// use crate::_eqf;

// #[test]
// fn with_pi() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does pi not pass anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the patched function now produces more accurate results, (sincosf(core::f32::consts::PI) = (-8.742278e-8, -1) ), the old test doesn't pass. I'm not really sure what to do with it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, interesting. Maybe just delete the test and leave a NB comment for the module, in case we replace this with an implementation that handles it (or just special cases?)

@tgross35
Copy link
Contributor

Thanks, does this lower the ULP error around multiples of pi/2?

@quaternic
Copy link
Contributor Author

Yes. I've tested it on your mpfr-test-branch with the special casing for sincosf removed, and it seemed to pass everything. (Assuming I haven't missed some crucial thing and accidentally not tested it at all.)

@tgross35
Copy link
Contributor

Oh, awesome! Thanks for being thorough.

@tgross35 tgross35 merged commit 5b79b6d into rust-lang:master Oct 28, 2024
14 checks passed
@tgross35
Copy link
Contributor

Thanks!

@github-actions github-actions bot mentioned this pull request Oct 28, 2024
@quaternic quaternic deleted the sincosf branch October 28, 2024 18:06
tgross35 pushed a commit that referenced this pull request Apr 18, 2025
* fix type of constants in ported sincosf
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants