]> git.lizzy.rs Git - rust.git/commitdiff
Rust unstable book: basic desc and example for `i128_type`.
authorCorey Farwell <coreyf@rwell.org>
Sun, 12 Mar 2017 02:07:58 +0000 (21:07 -0500)
committerCorey Farwell <coreyf@rwell.org>
Tue, 14 Mar 2017 01:38:44 +0000 (21:38 -0400)
src/doc/unstable-book/src/i128-type.md

index ffcf45feb2ad7ef5d1b570f887cbd6d21bdc3611..a850b7644c3a76fee296606cf1ea858640251c41 100644 (file)
@@ -6,5 +6,20 @@ The tracking issue for this feature is: [#35118]
 
 ------------------------
 
+The `i128_type` feature adds support for 128 bit signed and unsigned integer
+types.
 
+```rust
+#![feature(i128_type)]
+
+fn main() {
+    assert_eq!(1u128 + 1u128, 2u128);
+    assert_eq!(u128::min_value(), 0);
+    assert_eq!(u128::max_value(), 340282366920938463463374607431768211455);
+
+    assert_eq!(1i128 - 2i128, -1i128);
+    assert_eq!(i128::min_value(), -170141183460469231731687303715884105728);
+    assert_eq!(i128::max_value(), 170141183460469231731687303715884105727);
+}
+```