Skip to content

Commit

Permalink
Use f{32|64}::powi instead of Typenum::Pow::powi.
Browse files Browse the repository at this point in the history
In Rust 1.45 the upgrade to LLVM 10.0 changes the behavior of
`f{32|64}::powi` on Windows. This commit changes the `Quantity::powi`
implementation to simplify down to `f{32|64}::powi` instead of using
`Typenum::Pow::powi` which uses a less precise algorithm. Resolves #192.
  • Loading branch information
iliekturtles committed Jun 18, 2020
1 parent 0bc0b92 commit 551a281
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,18 +810,20 @@ macro_rules! system {
/// * `E`: `typenum::Integer` power.
#[inline(always)]
pub fn powi<E>(
self, e: E
self, _e: E
) -> Quantity<$quantities<$($crate::typenum::Prod<D::$symbol, E>),+>, U, V>
where
$(D::$symbol: $crate::lib::ops::Mul<E>,)+
D::Kind: $crate::marker::Mul,
E: $crate::typenum::Integer,
V: $crate::typenum::Pow<E, Output = V> + $crate::Conversion<V>,
V: $crate::Conversion<V>,
{
use $crate::ConversionFactor;

Quantity {
dimension: $crate::lib::marker::PhantomData,
units: $crate::lib::marker::PhantomData,
value: $crate::typenum::Pow::powi(self.value, e),
value: self.value.into_conversion().powi(E::to_i32()).value(),
}
}

Expand Down

0 comments on commit 551a281

Please sign in to comment.