|
@@ -781,6 +781,17 @@ impl FloatCore for f32 {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ #[inline]
|
|
|
+ #[cfg(not(feature = "std"))]
|
|
|
+ fn is_sign_negative(self) -> bool {
|
|
|
+ const SIGN_MASK: u32 = 0x80000000;
|
|
|
+
|
|
|
+ // Safety: this identical to the implementation of f32::to_bits(),
|
|
|
+ // which is only available starting at Rust 1.20
|
|
|
+ let bits: u32 = unsafe { mem::transmute(self) };
|
|
|
+ bits & SIGN_MASK != 0
|
|
|
+ }
|
|
|
+
|
|
|
#[inline]
|
|
|
#[cfg(not(feature = "std"))]
|
|
|
fn to_degrees(self) -> Self {
|
|
@@ -872,6 +883,17 @@ impl FloatCore for f64 {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ #[inline]
|
|
|
+ #[cfg(not(feature = "std"))]
|
|
|
+ fn is_sign_negative(self) -> bool {
|
|
|
+ const SIGN_MASK: u64 = 0x8000000000000000;
|
|
|
+
|
|
|
+ // Safety: this identical to the implementation of f64::to_bits(),
|
|
|
+ // which is only available starting at Rust 1.20
|
|
|
+ let bits: u64 = unsafe { mem::transmute(self) };
|
|
|
+ bits & SIGN_MASK != 0
|
|
|
+ }
|
|
|
+
|
|
|
#[inline]
|
|
|
#[cfg(not(feature = "std"))]
|
|
|
fn to_degrees(self) -> Self {
|