We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
abs
Float
1 parent 06ab1a2 commit f5d09dbCopy full SHA for f5d09db
compiler-builtins/src/float/mod.rs
@@ -98,6 +98,11 @@ pub(crate) trait Float:
98
/// Constructs a `Self` from its parts. Inputs are treated as bits and shifted into position.
99
fn from_parts(negative: bool, exponent: Self::Int, significand: Self::Int) -> Self;
100
101
+ fn abs(self) -> Self {
102
+ let abs_mask = !Self::SIGN_MASK ;
103
+ Self::from_bits(self.to_bits() & abs_mask)
104
+ }
105
+
106
/// Returns (normalized exponent, normalized significand)
107
fn normalize(significand: Self::Int) -> (i32, Self::Int);
108
0 commit comments