別のキーワード
ライブラリ
- ビルトイン (776)
- bigdecimal (66)
-
bigdecimal
/ util (11) - date (77)
-
json
/ add / rational (22) - mathn (8)
- matrix (143)
-
net
/ http (6) - stringio (11)
クラス
キーワード
- * (22)
- ** (15)
- + (11)
- - (22)
- -@ (19)
-
/ (21) - <=> (22)
- == (11)
- BigDecimal (22)
-
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 6 . 0 (6) - Numeric (11)
- Ruby用語集 (11)
- abs (8)
- ajd (11)
- amjd (11)
- at (47)
-
bigdecimal
/ util (11) - ceil (11)
- coerce (44)
- cofactor (11)
-
cofactor
_ expansion (11) - convert (11)
- denominator (33)
- det (11)
-
det
_ e (11) - determinant (11)
-
determinant
_ e (11) - div (11)
-
elements
_ to _ r (22) - exp (11)
- fdiv (11)
- finite? (8)
- floor (11)
- hash (11)
- i (11)
- inspect (11)
-
json
/ add / rational (11) -
json
_ create (11) -
laplace
_ expansion (11) - log (11)
- magnitude (8)
-
marshal
_ dump (11) - mathn (4)
- matrix (11)
- negative? (8)
- nonzero? (11)
- numerator (33)
- offset (11)
- positive? (8)
- putc (11)
- quo (22)
- rand (33)
- rank (11)
- rationalize (99)
- real (11)
- real? (11)
- round (11)
- rsqrt (4)
-
sec
_ fraction (11) -
second
_ fraction (11) - subsec (11)
-
to
_ c (11) -
to
_ d (11) -
to
_ f (11) -
to
_ i (11) -
to
_ int (11) -
to
_ json (11) -
to
_ r (88) -
to
_ s (11) - tr (11)
- trace (11)
- truncate (11)
-
write
_ timeout= (6)
検索結果
先頭5件
-
Rational
# <=>(other) -> -1 | 0 | 1 | nil (21048.0) -
self と other を比較して、self が大きい時に 1、等しい時に 0、小さい時に -1 を返します。比較できない場合はnilを返します。
...返します。
//emlist[例][ruby]{
Rational(2, 3) <=> Rational(2, 3) # => 0
Rational(5) <=> 5 # => 0
Rational(2, 3) <=> Rational(1,3) # => 1
Rational(1, 3) <=> 1 # => -1
Rational(1, 3) <=> 0.3 # => 1
Rational(1, 3) <=> nil # => nil
/... -
Rational
# to _ f -> Float (21048.0) -
自身の値を最も良く表現する Float に変換します。
...{
Rational(2).to_f # => 2.0
Rational(9, 4).to_f # => 2.25
Rational(-3, 4).to_f # => -0.75
Rational(20, 3).to_f # => 6.666666666666667
Rational(1, 10**1000).to_f # => 0.0
Rational(-1, 10**1000).to_f # => -0.0
Rational(10**1000).to_f # => Infinity
Rational(... -
Rational
# ==(other) -> bool (21036.0) -
数値として等しいか判定します。
...なければ 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
//}......でなければ 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
# denominator -> Integer (21030.0) -
分母を返します。常に正の整数を返します。
...分母を返します。常に正の整数を返します。
@return 分母を返します。
//emlist[例][ruby]{
Rational(7).denominator # => 1
Rational(7, 1).denominator # => 1
Rational(9, -4).denominator # => 4
Rational(-2, -10).denominator # => 5
//}
@see Rational#numerator... -
Rational
# fdiv(other) -> Float (21030.0) -
self を other で割った商を Float で返します。 other に虚数を指定することは出来ません。
...@param other 自身を割る数
//emlist[例][ruby]{
Rational(2, 3).fdiv(1) # => 0.6666666666666666
Rational(2, 3).fdiv(0.5) # => 1.3333333333333333
Rational(2).fdiv(3) # => 0.6666666666666666
Rational(1).fdiv(Complex(1, 0)) # => 1.0
Rational(1).fdiv(Complex(0, 1)) # => RangeError
//}... -
Rational
# inspect -> String (21030.0) -
自身を人間が読みやすい形の文字列表現にして返します。
...に10進数の表記を返します。
@return 有理数の表記にした文字列を返します。
//emlist[例][ruby]{
Rational(5, 8).inspect # => "(5/8)"
Rational(2).inspect # => "(2/1)"
Rational(-8, 6).inspect # => "(-4/3)"
Rational(0.5).inspect # => "(1/2)"
//}
@see Rational#to_s... -
Rational
# numerator -> Integer (21030.0) -
分子を返します。
...分子を返します。
@return 分子を返します。
//emlist[例][ruby]{
Rational(7).numerator # => 7
Rational(7, 1).numerator # => 7
Rational(9, -4).numerator # => -9
Rational(-2, -10).numerator # => 1
//}
@see Rational#denominator... -
Rational
# to _ s -> String (21030.0) -
自身を人間が読みやすい形の文字列表現にして返します。
..."-17/7" のように10進数の表記を返します。
@return 有理数の表記にした文字列を返します。
//emlist[例][ruby]{
Rational(3, 4).to_s # => "3/4"
Rational(8).to_s # => "8/1"
Rational(-8, 6).to_s # => "-4/3"
Rational(0.5).to_s # => "1/2"
//}
@see Rational#inspect... -
Rational
# marshal _ dump -> Array (21022.0) -
Marshal.#load のためのメソッドです。 Rational::compatible#marshal_load で復元可能な配列を返します。
...Marshal.#load のためのメソッドです。
Rational::compatible#marshal_load で復元可能な配列を返します。
[注意] Rational::compatible は通常の方法では参照する事ができません。... -
Rational
# negative? -> bool (21018.0) -
self が 0 未満の場合に true を返します。そうでない場合に false を返します。
...self が 0 未満の場合に true を返します。そうでない場合に false を返します。
//emlist[例][ruby]{
Rational(1, 2).negative? # => false
Rational(-1, 2).negative? # => true
//}
@see Rational#positive?...