Skip to content

Commit 137c1e8

Browse files
committed
Rust unstable book: basic desc and example for i128_type.
1 parent 0dd03ff commit 137c1e8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/doc/unstable-book/src/i128-type.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,20 @@ The tracking issue for this feature is: [#35118]
66

77
------------------------
88

9+
The `i128_type` feature adds support for 128 bit signed and unsigned integer
10+
types.
911

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+
```
1025

0 commit comments

Comments
 (0)