1084件ヒット
[1-100件を表示]
(0.093秒)
別のキーワード
ライブラリ
- ビルトイン (773)
- bigdecimal (24)
-
bigdecimal
/ util (12) - date (84)
-
json
/ add / rational (12) - mathn (4)
- matrix (156)
-
net
/ http (7) - stringio (12)
クラス
キーワード
- * (24)
- ** (16)
- + (12)
- - (24)
- -@ (21)
-
/ (35) - <=> (24)
- == (12)
- abs (9)
- ajd (12)
- amjd (12)
- ceil (12)
- coerce (48)
- cofactor (12)
-
cofactor
_ expansion (12) - convert (12)
- denominator (36)
- det (12)
-
det
_ e (12) - determinant (12)
-
determinant
_ e (12) - div (12)
-
elements
_ to _ r (24) - fdiv (12)
- finite? (9)
- floor (12)
- hash (12)
- i (12)
- inspect (12)
-
laplace
_ expansion (12) - magnitude (9)
-
marshal
_ dump (12) - negative? (9)
- nonzero? (12)
- numerator (36)
- offset (12)
- positive? (9)
- putc (12)
- quo (24)
- rand (36)
- rank (12)
- rationalize (108)
- real (12)
- real? (12)
- round (12)
-
sec
_ fraction (12) -
second
_ fraction (12) - subsec (12)
-
to
_ c (12) -
to
_ d (12) -
to
_ f (12) -
to
_ i (12) -
to
_ int (12) -
to
_ json (12) -
to
_ r (96) -
to
_ s (12) - tr (12)
- trace (12)
- truncate (12)
-
write
_ timeout= (7)
検索結果
先頭5件
-
Rational
# rationalize(eps = 0) -> Rational (15236.0) -
自身から eps で指定した許容誤差の範囲に収まるような Rational を返 します。
...な Rational を返
します。
eps を省略した場合は self を返します。
@param eps 許容する誤差
//emlist[例][ruby]{
r = Rational(5033165, 16777216)
r.rationalize # => (5033165/16777216)
r.rationalize(Rational(0.01)) # => (3/10)
r.rationalize(Rational(0.1))... -
Rational
# floor(precision = 0) -> Integer | Rational (9198.0) -
自身と等しいかより小さな整数のうち最大のものを返します。
...[ruby]{
Rational(3).floor # => 3
Rational(2, 3).floor # => 0
Rational(-3, 2).floor # => -2
//}
Rational#to_i とは違う結果を返す事に注意してください。
//emlist[例][ruby]{
Rational(+7, 4).to_i # => 1
Rational(+7, 4).floor # => 1
Rational(-7, 4).to_i # => -1
Rational(-7, 4......か Rational を返します。
//emlist[例][ruby]{
Rational('-123.456').floor(+1) # => (-247/2)
Rational('-123.456').floor(+1).to_f # => -123.5
Rational('-123.456').floor(0) # => -124
Rational('-123.456').floor(-1) # => -130
//}
@see Rational#ceil, Rational#round, Rational#tr... -
Rational
# round(precision = 0) -> Integer | Rational (9174.0) -
自身ともっとも近い整数を返します。
...//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 Rational#ceil, Rational#floor, Rational#truncate... -
Rational
# truncate(precision = 0) -> Rational | Integer (9174.0) -
小数点以下を切り捨てて値を整数に変換します。
...by]{
Rational(2, 3).to_i # => 0
Rational(3).to_i # => 3
Rational(300.6).to_i # => 300
Rational(98, 71).to_i # => 1
Rational(-31, 2).to_i # => -15
//}
precision を指定した場合は指定した桁数で切り捨てた整数か
Rational を返します。
//emlist[例][ruby]{
Rational('-......123.456').truncate(+1) # => (-617/5)
Rational('-123.456').truncate(+1).to_f # => -123.4
Rational('-123.456').truncate(0) # => -123
Rational('-123.456').truncate(-1) # => -120
//}
@see Rational#ceil, Rational#floor... -
Rational
# ceil(precision = 0) -> Integer | Rational (9168.0) -
自身と等しいかより大きな整数のうち最小のものを返します。
...//emlist[例][ruby]{
Rational(3).ceil # => 3
Rational(2, 3).ceil # => 1
Rational(-3, 2).ceil # => -1
//}
precision を指定した場合は指定した桁数の数値と、上述の性質に最も近い整
数か Rational を返します。
//emlist[例][ruby]{
Rational('-123.456').ceil(+1......) # => (-617/5)
Rational('-123.456').ceil(+1).to_f # => -123.4
Rational('-123.456').ceil(0) # => -123
Rational('-123.456').ceil(-1) # => -120
//}
@see Rational#floor, Rational#round, Rational#truncate... -
Rational
# convert(*arg) -> Rational (9130.0) -
引数を有理数(Rational)に変換した結果を返します。
...引数を有理数(Rational)に変換した結果を返します。
@param arg 変換対象のオブジェクトです。
Kernel.#Rational の本体です。
@see Kernel.#Rational... -
Rational
# **(other) -> Rational | Float (9120.0) -
冪(べき)乗を計算します。
...す。other が有理数であっても、計算結果が無理数だった場合は Float
を返します。
//emlist[例][ruby]{
r = Rational(3, 4)
r ** Rational(2, 1) # => (9/16)
r ** 2 # => (9/16)
r ** 2.0 # => 0.5625
r ** Rational(1, 2) # => 0.866025403784439
//}... -
Rational
# / (other) -> Rational | Float (9115.0) -
商を計算します。
...定した場合は、計算結果を 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 ZeroDivisionErr... -
Rational
# abs -> Rational (9115.0) -
自身の絶対値を返します。
...自身の絶対値を返します。
//emlist[例][ruby]{
Rational(1, 2).abs # => (1/2)
Rational(-1, 2).abs # => (1/2)
//}...