るりまサーチ

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

別のキーワード

  1. openssl integer
  2. asn1 integer
  3. _builtin integer
  4. integer chr
  5. integer new

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

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

算術演算子。積を計算します。

...算術演算子。積を計算します。

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

//emlist[][ruby]{
2 * 3 # => 6
//}...

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

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

...elf**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。

//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0...
...# => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-3.pow(3, 8) # => 5
-3.pow(3, -8) # => -3
5.pow(2, -8) # => -7
//}

結果が巨大すぎる整数になりそうなとき、警告を出したうえで Float::INFINITY を返します。

//emlist[計算を...
...放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}

判定の閾値は変わりえます。

@see BigDecimal#power...

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

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

...elf**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。

//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0...
...# => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-3.pow(3, 8) # => 5
-3.pow(3, -8) # => -3
5.pow(2, -8) # => -7
//}

結果が巨大すぎる整数になりそうなとき、警告を出したうえで Float::INFINITY を返します。

//emlist[計算を...
...放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}

判定の閾値は変わりえます。

@see BigDecimal#power...

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

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

...elf**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。

//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0...
...# => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-3.pow(3, 8) # => 5
-3.pow(3, -8) # => -3
5.pow(2, -8) # => -7
//}

結果が巨大すぎる整数になりそうなとき、警告を出したうえで Float::INFINITY を返します。

//emlist[計算を...
...放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}

判定の閾値は変わりえます。

@see BigDecimal#power...

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

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

...を指定した場合、Integer を返します。
小数点位置から左に少なくとも n 個の 0 が並びます。
@param half ちょうど半分の値の丸め方を指定します。
サポートされている値は以下の通りです。

*
:up or nil: 0から遠...
...い方に丸められます。
*
:even: もっとも近い偶数に丸められます。
*
:down: 0に近い方に丸められます。

//emlist[][ruby]{
1.round # => 1
1.round(2) # => 1.0
15.round(-1) # => 20
(-15).round(-1) # => -20

25.round(-1, half: :up) # => 30
25.roun...

絞り込み条件を変える

Integer#round(ndigits = 0, half: :up) -> Integer (21119.0)

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

...方を指定します。
サポートされている値は以下の通りです。

*
:up or nil: 0から遠い方に丸められます。
*
:even: もっとも近い偶数に丸められます。
*
:down: 0に近い方に丸められます。

//emlist[][ruby]{
1.round # => 1
1.ro...

Integer#to_f -> Float (21012.0)

self を浮動小数点数(Float)に変換します。

...self を浮動小数点数(Float)に変換します。

self が Float の範囲に収まらない場合、Float::INFINITY を返します。

//emlist[][ruby]{
1.to_f # => 1.0
(Float::MAX.to_i * 2).to_f # => Infinity
(-Float::MAX.to_i * 2).to_f # => -Infinity
//}...

static VALUE rb_to_integer(VALUE val, char *method) (6200.0)

BigDecimal#**(n) -> BigDecimal (6106.0)

self の n 乗を計算します。

...self の n 乗を計算します。

戻り値の有効桁数は self の有効桁数の n 倍以上になります。

@param n selfを other 乗する数を指定します。

@param prec 有効桁数を整数で指定します。


@see Integer#pow...

BigDecimal#power(n) -> BigDecimal (3006.0)

self の n 乗を計算します。

...self の n 乗を計算します。

戻り値の有効桁数は self の有効桁数の n 倍以上になります。

@param n selfを other 乗する数を指定します。

@param prec 有効桁数を整数で指定します。


@see Integer#pow...

絞り込み条件を変える

BigDecimal#power(n, prec) -> BigDecimal (3006.0)

self の n 乗を計算します。

...self の n 乗を計算します。

戻り値の有効桁数は self の有効桁数の n 倍以上になります。

@param n selfを other 乗する数を指定します。

@param prec 有効桁数を整数で指定します。


@see Integer#pow...

NEWS for Ruby 3.0.0 (1704.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...照してください。

== 言語仕様の変更

*
Keyword arguments are now separated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
*
Procs accepting a single rest argument and keywords...
...gument and no keywords.
16166

//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}

pr.call([1])
# 2.7 => [[1], {}]
# 3.0 => [[[1]], {}]

pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}

*
Arguments forwarding (`...`) now supports leading arguments....
...array. 12706
*
Now `{ a: 1 }.each(&->(k, v) { })` raises an ArgumentError due to lambda's arity check.
*
When writing to STDOUT redirected to a closed pipe, no broken pipe error message will be shown now. 14413
*
`TRUE`/`FALSE`/`NIL` constants are no longer defined.
*
Integer#zero? overr...
<< 1 2 3 ... > >>