]> git.lizzy.rs Git - rust.git/blob - src/doc/unstable-book/src/i128-type.md
Rollup merge of #40521 - TimNN:panic-free-shift, r=alexcrichton
[rust.git] / src / doc / unstable-book / src / i128-type.md
1 # `i128_type`
2
3 The tracking issue for this feature is: [#35118]
4
5 [#35118]: https://github.com/rust-lang/rust/issues/35118
6
7 ------------------------
8
9 The `i128_type` feature adds support for 128 bit signed and unsigned integer
10 types.
11
12 ```rust
13 #![feature(i128_type)]
14
15 fn main() {
16     assert_eq!(1u128 + 1u128, 2u128);
17     assert_eq!(u128::min_value(), 0);
18     assert_eq!(u128::max_value(), 340282366920938463463374607431768211455);
19
20     assert_eq!(1i128 - 2i128, -1i128);
21     assert_eq!(i128::min_value(), -170141183460469231731687303715884105728);
22     assert_eq!(i128::max_value(), 170141183460469231731687303715884105727);
23 }
24 ```
25