We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e5d0d53 commit 4226cecCopy full SHA for 4226cec
src/expressions/operator-expr.md
@@ -444,9 +444,9 @@ reference types and `mut` or `const` in pointer types.
444
assert_eq!(42.9f32 as i32, 42);
445
assert_eq!(-42.9f32 as i32, -42);
446
assert_eq!(42_000_000f32 as i32, 42_000_000);
447
- println!("Undefined Behavior: {}", 1_000_000_000_000_000f32 as i32);
448
- println!("Undefined Behavior: {}", std::f32::NEG_INFINITY as i32);
449
- println!("Undefined Behavior: {}", std::f32::NAN as i32);
+ assert_eq!(std::f32::NAN as i32, 0);
+ assert_eq!(1_000_000_000_000_000f32 as i32, 0x7fffffffi32);
+ assert_eq!(std::f32::NEG_INFINITY as i32, -0x80000000i32);
450
```
451
452
* Casting from an integer to float will produce the closest possible float \*
0 commit comments