File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -59,11 +59,21 @@ Rounds the number towards zero.
59
59
60
60
= head2 method base
61
61
62
- method base(Real:D: Int:D $base where 2..36) returns Str:D
62
+ method base(Real:D: Int:D $base where 2..36, $digits? ) returns Str:D
63
63
64
64
Converts the number to a string, using C < $base > as base. For C < $base > larger
65
65
than ten, capital Latin letters are used.
66
66
67
- 255.base(16) # 'FF'
67
+ 255.base(16) # 'FF'
68
+
69
+ The optional C < $digits > argument asks for that many digits of fraction
70
+ (which may not be negative). If omitted, a reasonable default is chosen
71
+ based on type. For Int this default is 0. For L < Num|/type/Num > , the default is 8.
72
+ For L < Rational|/type/Rational > , the number of places is scaled to the size of the denominator,
73
+ with a minimum of 6.
74
+
75
+ The final digit produced is always rounded.
76
+
77
+ say pi.base(10, 5); # 3.14159
68
78
69
79
= end pod
You can’t perform that action at this time.
0 commit comments