3件ヒット
[1-3件を表示]
(0.034秒)
検索結果
先頭3件
-
Rational
# quo(other) -> Rational | Float (45364.0) -
商を計算します。
商を計算します。
@param other 自身を割る数
other に Float を指定した場合は、計算結果を Float で返します。
//emlist[例][ruby]{
r = Rational(3, 4)
r / 2 # => (3/8)
r / 2.0 # => 0.375
r / 0.5 # => 1.5
r / Rational(1, 2) # => (3/2)
r / 0 # => ZeroDivisionError
//}
@raise ZeroD... -
Rational
# / (other) -> Rational | Float (64.0) -
商を計算します。
商を計算します。
@param other 自身を割る数
other に Float を指定した場合は、計算結果を Float で返します。
//emlist[例][ruby]{
r = Rational(3, 4)
r / 2 # => (3/8)
r / 2.0 # => 0.375
r / 0.5 # => 1.5
r / Rational(1, 2) # => (3/2)
r / 0 # => ZeroDivisionError
//}
@raise ZeroD... -
Integer
# / (other) -> Numeric (43.0) -
除算の算術演算子。
除算の算術演算子。
other が Integer の場合、整商(整数の商)を Integer で返します。
普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
other が Float、Rational、Complex の場合、普通の商を other と
同じクラスのインスタンスで返します。
@param other 二項演算の右側の引数(対象)
@return 計算結果
//emlist[例][ruby]{
7 / 2 # => 3
7 / -2 # => -4
7 / 2.0 # => 3.5
7 / Rational(2, 1) # => (7/2)
7...