Skip to content

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
@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.

2 participants