End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method · added in Ruby 3.2
Integer#ceildiv
ceildiv(other) → integer
numeric.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/numeric.rb, line 280
def ceildiv(other)
-div(-other)
end
Returns the result of division self by other. The result is rounded up to the nearest integer.
Example
3.ceildiv(3) # => 1 4.ceildiv(3) # => 2 4.ceildiv(-3) # => -1 -4.ceildiv(3) # => -1 -4.ceildiv(-3) # => 2 3.ceildiv(1.2) # => 3
Ruby version changes
-
3.2
-
Integer#ceildivhas been added. [Feature #18809]
-