352件ヒット
[301-352件を表示]
(0.168秒)
種類
- インスタンスメソッド (341)
- 特異メソッド (11)
ライブラリ
- ビルトイン (315)
-
bigdecimal
/ util (11) -
json
/ add / rational (22) - mathn (4)
キーワード
- * (11)
- ** (15)
- + (11)
- - (11)
- -@ (8)
-
/ (11) - <=> (11)
- == (11)
- abs (8)
- ceil (11)
- coerce (11)
- convert (11)
- denominator (11)
- fdiv (11)
- floor (11)
- hash (11)
- inspect (11)
-
json
_ create (11) - magnitude (8)
-
marshal
_ dump (11) - negative? (8)
- numerator (11)
- positive? (8)
- quo (11)
- rationalize (11)
- round (11)
-
to
_ d (11) -
to
_ f (11) -
to
_ i (11) -
to
_ json (11) -
to
_ r (11) -
to
_ s (11) - truncate (11)
検索結果
先頭5件
-
Rational
# quo(other) -> Rational | Float (6201.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 ZeroDivisionError other が 0 の時に発生します。
@see Numeric#quo... -
Rational
# round(precision = 0) -> Integer | Rational (6201.0) -
自身ともっとも近い整数を返します。
...げされます。
@param precision 計算結果の精度
@raise TypeError precision に整数以外のものを指定すると発生します。
//emlist[例][ruby]{
Rational(3).round # => 3
Rational(2, 3).round # => 1
Rational(-3, 2).round # => -2
//}
precision を指定した場合は指...... Rational を返します。
//emlist[例][ruby]{
Rational('-123.456').round(+1) # => (-247/2)
Rational('-123.456').round(+1).to_f # => -123.5
Rational('-123.456').round(0) # => -123
Rational('-123.456').round(-1) # => -120
Rational('-123.456').round(-2) # => -100
//}
@see Rat......ional#ceil, Rational#floor, Rational#truncate... -
Rational
# **(rhs) -> Numeric (6101.0) -
@todo
...@todo
self のべき乗を返します。 Rational になるようであれば Rational で返します。... -
Rational
# ==(other) -> bool (6101.0) -
数値として等しいか判定します。
...param other 自身と比較する数値
@return self と other が等しい場合 true を返します。
そうでなければ false を返します。
//emlist[例][ruby]{
Rational(2, 3) == Rational(2, 3) # => true
Rational(5) == 5 # => true
Rational(0)......== 0.0 # => true
Rational('1/3') == 0.33 # => false
Rational('1/2') == '1/2' # => false
//}... -
Rational
# coerce(other) -> Array (6101.0) -
自身と other が同じクラスになるよう、自身か other を変換し [other, self] という 配列にして返します。
...自身と other が同じクラスになるよう、自身か other を変換し [other, self] という
配列にして返します。
@param other 比較または変換するオブジェクト
//emlist[例][ruby]{
Rational(1).coerce(2) # => [(2/1), (1/1)]
Rational(1).coerce(2.2) # => [2.2, 1.... -
Rational
# marshal _ dump -> Array (6001.0) -
Marshal.#load のためのメソッドです。 Rational::compatible#marshal_load で復元可能な配列を返します。
...Marshal.#load のためのメソッドです。
Rational::compatible#marshal_load で復元可能な配列を返します。
[注意] Rational::compatible は通常の方法では参照する事ができません。...