るりまサーチ

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

別のキーワード

  1. openssl g
  2. openssl g=
  3. dh g
  4. dsa g
  5. dh g=

ライブラリ

キーワード

検索結果

<< 1 2 > >>

Rational#negative? -> bool (6102.0)

self が 0 未満の場合に true を返します。そうでない場合に false を返します。

...self が 0 未満の場合に true を返します。そうでない場合に false を返します。

//emlist[例][ruby]{
Rational
(1, 2).negative? # => false
Rational
(-1, 2).negative? # => true
//}

@see Rational#positive?...

Rational#magnitude -> Rational (3102.0)

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

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

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

Rational#ceil(precision = 0) -> Integer | Rational (102.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 (102.0)

引数を有理数(Rational)に変換した結果を返します。

...引数を有理数(Rational)に変換した結果を返します。

@param arg 変換対象のオブジェクトです。

Kernel.#Rational の本体です。

@see Kernel.#Rational...

Rational#denominator -> Integer (102.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#floor(precision = 0) -> Integer | Rational (102.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#hash -> Integer (102.0)

自身のハッシュ値を返します。

自身のハッシュ値を返します。

@return ハッシュ値を返します。


@see Object#hash

Rational#inspect -> String (102.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 (102.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...
<< 1 2 > >>