self / other -> Numeric[permalink][rdoc][edit]-
selfをotherで割った値(=商)を返します。otherのクラスによって除算の種類が異なります。otherがIntegerの場合、整商(整数の商)をIntegerで返します。普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。otherが Float、Rational、Complex の場合、普通の商をotherと同じクラスのインスタンスで返します。Integerオブジェクトを左項とする算術演算子/はこのメソッドの呼び出しになります。- [PARAM]
other: -
selfに対する除数
# 整商を返す例 p 7 / 2 # => 3 p 7 / -2 # => -4 # 普通の商を返す例 p 7 / 2.0 # => 3.5 p 7 / 2r # => (7/2) p 7 / (2+0i) # => ((7/2)+0i) begin 2 / 0 rescue => e e # => #<ZeroDivisionError: divided by 0> end[SEE_ALSO] Integer#div, Integer#fdiv, Numeric#quo
- [PARAM]