Maintenance of Ruby 2.0.0 ended on February 24, 2016. Read more

In Files

  • numeric.c

Parent

ZeroDivisionError

Raised when attempting to divide an integer by 0.

42 / 0

raises the exception:

ZeroDivisionError: divided by 0

Note that only division by an exact 0 will raise that exception:

42 /  0.0 #=> Float::INFINITY
42 / -0.0 #=> -Float::INFINITY
0  /  0.0 #=> NaN