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

Pow support #132

Merged
merged 7 commits into from
Apr 25, 2023
Merged

Pow support #132

merged 7 commits into from
Apr 25, 2023

Conversation

cdchamness
Copy link
Contributor

Issue #118 asked for implementation of the Pow trait for OrderedFloat and NotNan. I have implemented the Pow trait for both in 2 ways.

  1. This implements the trait for exponents that are primitive types (i8, i16, i32, u8, u16, f32, f64) that num_traits does, https://docs.rs/num-traits/latest/num_traits/pow/trait.Pow.html, for the f32 and f64 types respectfully.
  2. This implements the trait for exponents and bases that both either OrderedFloat or NotNan.

I have not implemented any mixing of OrderedFloat and NotNan, as the proper return type is not obvious. I have also not implemented Pow for the base being primitive (i8, i16, i32, u8, u16, f32, f64) with an exponent of either OrderedFloat or NotNan, as again the return type for this operation is not clear to me.

I also added a few tests to ensure things are working as expected.

@mbrubeck
Copy link
Collaborator

Thanks! It looks like these just need to be #[cfg(feature = "std")].

@mbrubeck mbrubeck merged commit dd6956a into reem:master Apr 25, 2023
2 checks passed
@cdchamness cdchamness deleted the pow_support branch April 25, 2023 04:19
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