Skip to content

Add FloatCore::round_ties_even #350

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bushrat011899
Copy link

Objective

Since Rust 1.77, round_ties_even was added to f32 and f64 in the standard library. This function is used within WGPU, and as a part of a push for no_std support, this function will need to be shimmed. It could be shimmed within Naga, but this functionality may have value to other users of num-traits.

Solution

  • Added round_ties_even to FloatCore with a default implementation (not a breaking change)
  • Added a new feature, msrv_1_77, which allows overriding the default implementation of FloatCore::round_ties_even for f32 and f64 with the implementation from std (not a breaking change)
  • Added a test ensuring the fallback implementation of round_ties_even matches the implementation in std for the f32 type (assuming it is equally valid for f64)

Notes

  • The msrv_1_77 feature increases MSRV to 1.77, which is a typical arrangement (e.g., serde features will typically elevate MSRV). If/when num-traits advances past MSRV 1.77, this feature can become a no-op without any breaking changes.
  • This is my first contribution to num-traits, please let me know if there's anything I can do to help!

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

Successfully merging this pull request may close these issues.

1 participant