MCPcopy Create free account
hub / github.com/LaBatata101/sith-language-server / is_zero

Method is_zero

crates/sith_python_ast/src/float.rs:57–66  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

55 }
56
57 pub fn is_zero(&self) -> bool {
58 let FloatInner::FloatNumber { upper, lower } = self.0 else {
59 return false;
60 };
61
62 // In IEEE 754, zero is represented with all exponent and mantissa bits set to 0
63 // The sign bit can be either 0 (positive zero) or 1 (negative zero)
64 // So we check if the lower 63 bits are all zero (ignoring the sign bit)
65 (upper & 0x7FFFFFFF) == 0 && lower == 0
66 }
67}
68
69impl std::fmt::Display for Float {

Callers 2

eqMethod · 0.80
hashMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected