るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. _builtin float
  2. float to_d
  3. json float
  4. float rationalize
  5. fiddle type_float

ライブラリ

クラス

キーワード

検索結果

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

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

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

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

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

Float#%(other) -> Float (63313.0)

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

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

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

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

Float#divmod(other) -> [Numeric] (63022.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...

Bignum#modulo(other) -> Fixnum | Bignum | Float (45613.0)

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

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

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

Fixnum#modulo(other) -> Fixnum | Bignum | Float (45613.0)

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

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

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

絞り込み条件を変える

Integer#pow(other, modulo) -> Integer (379.0)

算術演算子。冪(べき乗)を計算します。

算術演算子。冪(べき乗)を計算します。

@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。

//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
...

Bignum#remainder(other) -> Fixnum | Bignum | Float (343.0)

self を other で割った余り r を返します。

self を other で割った余り r を返します。

r の符号は self と同じになります。

@param other self を割る数。

@see Bignum#divmod, Bignum#modulo, Numeric#modulo

Bignum#%(other) -> Fixnum | Bignum | Float (313.0)

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

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

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

Fixnum#%(other) -> Fixnum | Bignum | Float (313.0)

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

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

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

Integer#**(other) -> Numeric (79.0)

算術演算子。冪(べき乗)を計算します。

算術演算子。冪(べき乗)を計算します。

@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。

//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
...

絞り込み条件を変える

Integer#pow(other) -> Numeric (79.0)

算術演算子。冪(べき乗)を計算します。

算術演算子。冪(べき乗)を計算します。

@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。

//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
...

Integer#div(other) -> Integer (58.0)

整商(整数の商)を返します。 普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。

整商(整数の商)を返します。
普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。

other が Integer オブジェクトの場合、Integer#/ の結果と一致します。

div に対応する剰余メソッドは modulo です。

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

//emlist[例][ruby]{
7.div(2) # => 3
7.div(-2) # => -4
7.div(2.0) # => 3
7.div(Rational(2, 1)) # => 3

begin
2.div(0)
rescue => ...