るりまサーチ

最速Rubyリファレンスマニュアル検索!
67件ヒット [1-67件を表示] (0.141秒)

別のキーワード

  1. erb u
  2. util u
  3. matrix u
  4. encoding koi8_u
  5. _builtin koi8_u

ライブラリ

キーワード

検索結果

Rational#marshal_dump -> Array (6102.0)

Marshal.#load のためのメソッドです。 Rational::compatible#marshal_load で復元可能な配列を返します。

...Marshal.#load のためのメソッドです。
Rational
::compatible#marshal_load で復元可能な配列を返します。

[注意] Rational::compatible は通常の方法では参照する事ができません。...

Rational#numerator -> Integer (6102.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#round(precision = 0) -> Integer | Rational (6102.0)

自身ともっとも近い整数を返します。

...ist[例][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#magnitude -> Rational (3102.0)

自身の絶対値を返します。

...自身の絶対値を返します。

//emlist[例][ruby]{
Rational
(1, 2).abs # => (1/2)
Rational
(-1, 2).abs # => (1/2)
//}...

Rational#quo(other) -> Rational | Float (3102.0)

商を計算します。

...//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#truncate(precision = 0) -> Rational | Integer (3102.0)

小数点以下を切り捨てて値を整数に変換します。

...ruby]{
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#**(rhs) -> Numeric (102.0)

@todo

...@todo

self のべき乗を返します。 Rational になるようであれば Rational で返します。...