method

remainder

Importance_1
v2_5_5 - Show latest stable - 0 notes - Class: Integer
remainder(p1) public

Returns the remainder after dividing int by numeric.

x.remainder(y) means x-y*(x/y).truncate.

5.remainder(3)     #=> 2
-5.remainder(3)    #=> -2
5.remainder(-3)    #=> 2
-5.remainder(-3)   #=> -2
5.remainder(1.5)   #=> 0.5

See Numeric#divmod.

Show source
Register or log in to add new notes.