(&self)
| 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 | |
| 69 | impl std::fmt::Display for Float { |