Skip to content

Implements num_traits::real::Real for NotNan<T> #176

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

DouisLavid
Copy link

This is the counterpart of the implementation of Float for OrderedFloat as Real is "A trait for real number types that do not necessarily have floating-point-specific characteristics such as NaN and infinity."

Operations that would result in a NaN cause a panic, as it is the behaviour that it suggested in the num_trait docs. Checks for NaN results are only done in cases where a NaN could be expected, and assumes that the implementation of Real for the underlying type is sane otherwise.

…oatCore

Forwards the calls of Real trait methods to the underlying type, panicking when the result is NaN, as suggested in https://docs.rs/num-traits/latest/num_traits/real/trait.Real.html
Also adds a few tests to ensure things actually panic when they should.
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