Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
define correct type of the UInt; show some example usage
  • Loading branch information
tbrowder committed Aug 31, 2016
1 parent 1104dc2 commit 68b6859
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion doc/Type/UInt.pod6
@@ -1,6 +1,6 @@
=begin pod
=TITLE class UInt
=TITLE subset UInt
=SUBTITLE Unsigned Integer (arbitrary-precision)
Expand All @@ -9,4 +9,20 @@ The C<UInt> is defined as a subset of C<Int>:
=for code :skip-test
my subset UInt of Int where * >= 0;
Consequently it can be instantiated or subclassed; however, that shouldn't affect most normal uses.
Some examples of its behavior and uses:
=for code :skip-test
my UInt $u = 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff; # 64-bit unsigned value
say $u.base(16); # FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (32 digits)
++$u;
say $u.base(16); # 100000000000000000000000000000000 (33 digits!)
my Int $i = $u;
say $i.base(16); # same
say $u.WHAT; # (UInt)
say $i.WHAT; # (Int)
$u = $i;
say $u.WHAT; # (Int)!! a subset of Int is an Int
=end pod

0 comments on commit 68b6859

Please sign in to comment.