Skip to content

Commit f00a14e

Browse files
committed
[Cool] floor, ceiling
1 parent dedd8d8 commit f00a14e

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

lib/Type/Cool.pod

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,29 @@ C<$unit>. If C<$unit> is 1, rounds to the nearest integer.
308308
say 1.07.round(0.1); # 1.1
309309
say 21.round(10); # 20
310310
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+
311334
=head2 method ord
312335
313336
method ord()
@@ -395,7 +418,7 @@ leading and trailing whitespace stripped.
395418
=begin comment
396419
397420
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,
399422
tclc, wordcase, chomp, chop, chrs, trans, index, rindex, ords,
400423
split, match, comb, lines, words, subst, sprintf, printf, samecase, path,
401424
EVAL

0 commit comments

Comments
 (0)