(x: f32)
| 262 | // Next representable f32 strictly greater than `x`. |
| 263 | #[inline] |
| 264 | fn next_up_f32(x: f32) -> f32 { |
| 265 | if x.is_nan() || x == f32::INFINITY { |
| 266 | return x; |
| 267 | } |
| 268 | let bits = x.to_bits(); |
| 269 | if x.is_sign_negative() { |
| 270 | // negative: decreasing magnitude (bits decrease) moves toward 0 / +inf |
| 271 | if bits == 0x8000_0000 { |
| 272 | f32::from_bits(0x0000_0001) // -0 -> smallest positive subnormal |
| 273 | } else { |
| 274 | f32::from_bits(bits - 1) |
| 275 | } |
| 276 | } else { |
| 277 | // positive or +0: increasing bits moves toward +inf |
| 278 | f32::from_bits(bits + 1) |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | // Next representable f32 strictly less than `x`. |
| 283 | #[inline] |
no outgoing calls
no test coverage detected