Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
document $digits argument to .base
stolen from the design docs
  • Loading branch information
moritz committed Feb 14, 2015
1 parent 8ba60b3 commit d82788a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/Type/Real.pod
Expand Up @@ -59,11 +59,21 @@ Rounds the number towards zero.
=head2 method base
method base(Real:D: Int:D $base where 2..36) returns Str:D
method base(Real:D: Int:D $base where 2..36, $digits?) returns Str:D
Converts the number to a string, using C<$base> as base. For C<$base> larger
than ten, capital Latin letters are used.
255.base(16) # 'FF'
255.base(16) # 'FF'
The optional C<$digits> argument asks for that many digits of fraction
(which may not be negative). If omitted, a reasonable default is chosen
based on type. For Int this default is 0. For L<Num|/type/Num>, the default is 8.
For L<Rational|/type/Rational>, the number of places is scaled to the size of the denominator,
with a minimum of 6.
The final digit produced is always rounded.
say pi.base(10, 5); # 3.14159
=end pod

0 comments on commit d82788a

Please sign in to comment.