I am looking through a documentation on divmod. Part of a table showing the difference between methods div
, divmod
, modulo
, and remainder
is displayed below:
Why is 13.div(-4)
rounded to -4
and not to -3
? Is there any rule or convention in Ruby to round down negative numbers? If so, why is the following code not rounding down?
-3.25.round() #3