diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2021-04-16 14:36:07 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2021-04-16 14:36:07 +0200 |
| commit | 7f0e35106e3cce054551de8305f8bcbc25ef59f8 (patch) | |
| tree | 5678930a67bcbb3a8c99840890389b4f141c80c5 /example/std_example.rs | |
| parent | 6d6c5742896fab93788b4dabb6ba2fcf1881f5e2 (diff) | |
| download | rust-7f0e35106e3cce054551de8305f8bcbc25ef59f8.tar.gz rust-7f0e35106e3cce054551de8305f8bcbc25ef59f8.zip | |
Fix overflow checking when multiplying two i64
Fixes #1162
Diffstat (limited to 'example/std_example.rs')
| -rw-r--r-- | example/std_example.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/example/std_example.rs b/example/std_example.rs index 437b7726980..77ba72df8ef 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -48,6 +48,8 @@ fn main() { assert_eq!(2.3f32.copysign(-1.0), -2.3f32); println!("{}", 2.3f32.powf(2.0)); + assert_eq!(i64::MAX.checked_mul(2), None); + assert_eq!(-128i8, (-128i8).saturating_sub(1)); assert_eq!(127i8, 127i8.saturating_sub(-128)); assert_eq!(-128i8, (-128i8).saturating_add(-128)); |
