D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Float
/
Filename :
ceil-i.ri
back
Copy
U:RDoc::AnyMethod[iI" ceil:ETI"Float#ceil;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"�Returns a numeric that is a "ceiling" value for <code>self</code>, as specified by the given <code>ndigits</code>, which must be an {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects].;To; ; [I"�When <code>ndigits</code> is positive, returns a Float with <code>ndigits</code> decimal digits after the decimal point (as available, but no fewer than 1):;To:RDoc::Markup::Verbatim; [I"�f = 12345.6789 f.ceil(1) # => 12345.7 f.ceil(3) # => 12345.679 f.ceil(30) # => 12345.6789 f = -12345.6789 f.ceil(1) # => -12345.6 f.ceil(3) # => -12345.678 f.ceil(30) # => -12345.6789 f = 0.0 f.ceil(1) # => 0.0 f.ceil(100) # => 0.0 ;T:@format0o; ; [I"cWhen <code>ndigits</code> is non-positive, returns an Integer based on a computed granularity:;To:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I"7The granularity is <code>10 ** ndigits.abs</code>.;To;;0; [o; ; [I"tThe returned value is the largest multiple of the granularity that is less than or equal to <code>self</code>.;To; ; [I".Examples with positive <code>self</code>:;To:RDoc::Markup::Table:@header[I"ndigits;TI"Granularity;TI"12345.6789.ceil(ndigits);T:@align[: right;;: @body[[I"0;TI"1;TI" 12346;T[I"-1;TI"10;TI" 12350;T[I"-2;TI"100;TI" 12400;T[I"-3;TI" 1000;TI" 13000;T[I"-4;TI" 10000;TI" 20000;T[I"-5;TI"100000;TI"100000;To; ; [I".Examples with negative <code>self</code>:;To;;[I"ndigits;TI"Granularity;TI"-12345.6789.ceil(ndigits);T;[;;;;[[I"0;TI"1;TI"-12345;T[I"-1;TI"10;TI"-12340;T[I"-2;TI"100;TI"-12300;T[I"-3;TI" 1000;TI"-12000;T[I"-4;TI" 10000;TI"-10000;T[I"-5;TI"100000;TI"0;To; ; [I"cWhen <code>self</code> is zero and <code>ndigits</code> is non-positive, returns Integer zero:;To;; [I"A0.0.ceil(0) # => 0 0.0.ceil(-1) # => 0 0.0.ceil(-2) # => 0 ;T;0o; ; [I"aNote that the limited precision of floating-point arithmetic may lead to surprising results:;To;; [I"Z(2.1 / 0.7).ceil #=> 4 # Not 3 (because 2.1 / 0.7 # => 3.0000000000000004, not 3.0) ;T;0o; ; [I"Related: Float#floor.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"+ceil(ndigits = 0) -> float or integer ;T0[ I"(*args);T@vFI" Float;TcRDoc::NormalClass00