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

Add lossy conversion for NotNan<f64> to NotNan<f32> #109

Merged
merged 2 commits into from Apr 30, 2022
Merged

Add lossy conversion for NotNan<f64> to NotNan<f32> #109

merged 2 commits into from Apr 30, 2022

Conversation

MultisampledNight
Copy link
Contributor

Currently, it's not cleanly possible to convert a NotNan<f64> to a NotNan<f32> if you're aware of the precision loss and are ready to take it without unwrapping and re-wrapping again.

So this PR addresses this through adding a NotNan::<f64>::into_notnan_f64_lossy which does that automatically.

I'm not sure about the naming of the method. I'd like to shorten it, and also I'm not sure whether that's a case for using as_ naming, as the Rust API guidelines suggest.

@mbrubeck
Copy link
Collaborator

Thanks!

For naming, I think a shorter name like as_f32 or to_32_bit would be fine.

@MultisampledNight
Copy link
Contributor Author

Thank you for the consideration! I changed the name as_f32 accordingly.

@mbrubeck mbrubeck merged commit 61975f1 into reem:master Apr 30, 2022
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.

None yet

2 participants