@@ -308,6 +308,29 @@ C<$unit>. If C<$unit> is 1, rounds to the nearest integer.
308
308
say 1.07.round(0.1); # 1.1
309
309
say 21.round(10); # 20
310
310
311
+ = head2 method floor
312
+
313
+ multi method floor
314
+
315
+ Coerces the invocant to L < Numeric|/type/Numeric > , and rounds it downwards to
316
+ the nearest integer.
317
+
318
+ say "1.99".floor; # 1
319
+ say "-1.9".floor; # -2
320
+ say 0.floor; # 0
321
+
322
+ = head2 method ceiling
323
+
324
+ multi method ceiling
325
+
326
+ Coerces the invocant to L < Numeric|/type/Numeric > , and rounds it upwards to
327
+ the nearest integer.
328
+
329
+ say "1".ceiling; # 1
330
+ say "-0.9".ceiling; # 0
331
+ say "42.1".ceiling; # 43
332
+
333
+
311
334
= head2 method ord
312
335
313
336
method ord()
@@ -395,7 +418,7 @@ leading and trailing whitespace stripped.
395
418
= begin comment
396
419
397
420
TODO: sech, asech, cosech, acosech, cotanh, acotanh, cis, roots, log10,
398
- unpolar, floor, ceiling, truncate, fmt, substr, substr-rw, uc, lc, tc,
421
+ unpolar, truncate, fmt, substr, substr-rw, uc, lc, tc,
399
422
tclc, wordcase, chomp, chop, chrs, trans, index, rindex, ords,
400
423
split, match, comb, lines, words, subst, sprintf, printf, samecase, path,
401
424
EVAL
0 commit comments