ceil

rat.ceil â integer
rat.ceil(precision=0) â rational
Instance Public methods

Returns the truncated value (toward positive infinity).

1
2
3
4
5
6
7
8
9
10
Rational(3).ceil      #=> 3
Rational(2, 3).ceil   #=> 1
Rational(-3, 2).ceil  #=> -1
 
       decimal      -  1  2  3 . 4  5  6
                      ^  ^  ^  ^   ^  ^
      precision      -3 -2 -1  0  +1 +2
 
'%f' % Rational('-123.456').ceil(+1#=> "-123.400000"
'%f' % Rational('-123.456').ceil(-1#=> "-120.000000"
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.