るりまサーチ (Ruby 2.6.0)

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

別のキーワード

  1. matrix l
  2. kernel $-l
  3. _builtin $-l
  4. lupdecomposition l
  5. l

ライブラリ

キーワード

検索結果

Float#modulo(other) -> Float (27907.0)

算術演算子。剰余を計算します。

算術演算子。剰余を計算します。

@param other 二項演算の右側の引数(対象)

//emlist[例][ruby]{
# 剰余
3.0 % 1.2 # => 0.6000000000000001
3.0 % 0.0 # ZeroDivisionError
//}

Float#round(ndigits = 0) -> Integer | Float (27607.0)

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

...d(-2) # => 93600
t.round(-3) # => 94000
t.round(-100) # => 0

2.5.round(half: :up) # => 3
2.5.round(half: :even) # => 2
2.5.round(half: :down) # => 2
3.5.round(half: :up) # => 4
3.5.round(half: :even) # => 4
3.5.round(half: :down) # => 3
//}

@see Float#ceil, Float#floor, Float#truncate...

Float#round(ndigits = 0, half: :up) -> Integer | Float (27607.0)

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

...d(-2) # => 93600
t.round(-3) # => 94000
t.round(-100) # => 0

2.5.round(half: :up) # => 3
2.5.round(half: :even) # => 2
2.5.round(half: :down) # => 2
3.5.round(half: :up) # => 4
3.5.round(half: :even) # => 4
3.5.round(half: :down) # => 3
//}

@see Float#ceil, Float#floor, Float#truncate...

Float#numerator -> Integer (27307.0)

自身を Rational に変換した時の分子を返します。

...自身を Rational に変換した時の分子を返します。

@return 分子を返します。

//emlist[例][ruby]{
2.0.numerator # => 2
0.5.numerator # => 1
//}

@see Float#denominator...

Float#magnitude -> Float (18607.0)

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

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

//emlist[例][ruby]{
34.56.abs # => 34.56
-34.56.abs # => 34.56
//}

絞り込み条件を変える

Float#truncate(ndigits = 0) -> Integer | Float (18607.0)

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

...

@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返...

Float#divmod(other) -> [Numeric] (9307.0)

self を other で割った商 q と余り r を、 [q, r] という 2 要素の配列にして返します。 商 q は常に整数ですが、余り r は整数であるとは限りません。

self を other で割った商 q と余り r を、
[q, r] という 2 要素の配列にして返します。
商 q は常に整数ですが、余り r は整数であるとは限りません。

ここで、商 q と余り r は、

* self == other * q + r

* other > 0 のとき: 0 <= r < other
* other < 0 のとき: other < r <= 0
* q は整数
をみたす数です。
このメソッドは、メソッド / と % によって定義されています。

@param other 自身を割る数を指定します。

//emli...