Comment the i32::MIN case for FloatCore::powi
This commit is contained in:
parent
aa9ceba628
commit
080f6f259e
|
@ -5,7 +5,7 @@ use core::num::FpCategory;
|
||||||
use core::f32;
|
use core::f32;
|
||||||
use core::f64;
|
use core::f64;
|
||||||
|
|
||||||
use {Num, NumCast};
|
use {Num, NumCast, ToPrimitive};
|
||||||
|
|
||||||
/// Generic trait for floating point numbers that works with `no_std`.
|
/// Generic trait for floating point numbers that works with `no_std`.
|
||||||
///
|
///
|
||||||
|
@ -668,7 +668,9 @@ pub trait FloatCore: Num + NumCast + Neg<Output = Self> + PartialOrd + Copy {
|
||||||
self = self.recip();
|
self = self.recip();
|
||||||
}
|
}
|
||||||
// It should always be possible to convert a positive `i32` to a `usize`.
|
// It should always be possible to convert a positive `i32` to a `usize`.
|
||||||
super::pow(self, exp as u32 as usize)
|
// Note, `i32::MIN` will wrap and still be negative, so we need to convert
|
||||||
|
// to `u32` without sign-extension before growing to `usize`.
|
||||||
|
super::pow(self, (exp as u32).to_usize().unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Converts to degrees, assuming the number is in radians.
|
/// Converts to degrees, assuming the number is in radians.
|
||||||
|
|
Loading…
Reference in New Issue