Project

General

Profile

Actions

Feature #12245

closed

optional parameter ndigits to Integer#floor, Integer#ceil, Float#floor, Float#ceil

Added by nobu (Nobuyoshi Nakada) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:74788]

Updated by shevegen (Robert A. Heiler) over 8 years ago

I think that would make sense.

I usually add an extra method call afterwards to round it manually (or, if not .round then to use it as a string and sprintf, % or .ljust / .rjust output it).

I should also note that newcomers often ask on IRC how to round / display something properly, so anything that may be of help here, is good I think. (It will be typical question such as how to display a float like 3.0 as 3.000, if only for properly padded output with other float values that will have 3 slots past the . like 2.983 and so on)

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Status changed from Open to Closed

Applied in changeset r54562.


numeric.c: int_ceil

  • numeric.c (int_ceil): add an optional parameter, digits, as
    well as Integer#round. [Feature #12245]
Actions

Also available in: Atom PDF

Like0
Like0Like0