るりまサーチ

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

別のキーワード

  1. _builtin **
  2. matrix **
  3. bigdecimal **
  4. rational **
  5. bn **

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Integer#**(other) -> Numeric (18175.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
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) #...
...数になりそうなとき、警告を出したうえで Float::INFINITY を返します。

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

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

@
see BigDecimal#power...

Bignum#**(other) -> Fixnum | Bignum | Float (18133.0)

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

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

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

2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1...

Fixnum#**(other) -> Fixnum | Bignum | Float (18133.0)

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

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

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

2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1...

Rational#**(other) -> Rational | Float (18133.0)

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

...ます。

@
param other 自身を other 乗する数

other に Float を指定した場合は、計算結果を Float で返しま
す。other が有理数であっても、計算結果が無理数だった場合は Float
を返します。

//emlist[例][ruby]{
r = Rational(3, 4)
r ** Rational(2,...
...1) # => (9/16)
r ** 2 # => (9/16)
r ** 2.0 # => 0.5625
r ** Rational(1, 2) # => 0.866025403784439
//}...

Float#**(other) -> Float (18127.0)

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

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

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

//emlist[例][ruby]{
# 冪
1.2 ** 3.0 # => 1.7279999999999998
3.0 + 4.5 - 1.3 / 2.4 * 3 % 1.2 ** 3.0 # => 5.875
0.0 ** 0 # => 1.0
//}...

絞り込み条件を変える

Complex#**(other) -> Complex (18115.0)

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

...冪(べき)乗を計算します。

@
param other 自身を other 乗する数

//emlist[例][ruby]{
Complex('i') ** 2 # => (-1+0i)
//}...

Integer#pow(other) -> Numeric (3075.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
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) #...
...数になりそうなとき、警告を出したうえで 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 (3075.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
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) #...
...数になりそうなとき、警告を出したうえで Float::INFINITY を返します。

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

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

@
see BigDecimal#power...

String#encode(**options) -> String (135.0)

self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

...われません。

@
param encoding 変換先のエンコーディングを表す文字列か Encoding オブジェクトを指定します。
@
param from_encoding 変換元のエンコーディングを表す文字列か Encoding オブジェクトを指定します。
@
param option...
...変換オプションをキーワード引数で与えます。
@
return 変換された文字列

変換オプション

: :invalid => nil
変換元のエンコーディングにおいて不正なバイトがあった場合に、例外 Encoding::InvalidByteSequenceError を投げま...
...ようとすると Encoding::UndefinedConversionError が発生する
str = "\u00b7\u2014"
str.encode("Windows-31J", fallback: { "\u00b7" => "\xA5".force_encoding("Windows-31J"),
"\u2014" => "\x81\x5C".force_encoding("Windows-31J") })
//}

@
see String#encode!...

String#encode(encoding, **options) -> String (135.0)

self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

...われません。

@
param encoding 変換先のエンコーディングを表す文字列か Encoding オブジェクトを指定します。
@
param from_encoding 変換元のエンコーディングを表す文字列か Encoding オブジェクトを指定します。
@
param option...
...変換オプションをキーワード引数で与えます。
@
return 変換された文字列

変換オプション

: :invalid => nil
変換元のエンコーディングにおいて不正なバイトがあった場合に、例外 Encoding::InvalidByteSequenceError を投げま...
...ようとすると Encoding::UndefinedConversionError が発生する
str = "\u00b7\u2014"
str.encode("Windows-31J", fallback: { "\u00b7" => "\xA5".force_encoding("Windows-31J"),
"\u2014" => "\x81\x5C".force_encoding("Windows-31J") })
//}

@
see String#encode!...

絞り込み条件を変える

String#encode(encoding, from_encoding, **options) -> String (135.0)

self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

...われません。

@
param encoding 変換先のエンコーディングを表す文字列か Encoding オブジェクトを指定します。
@
param from_encoding 変換元のエンコーディングを表す文字列か Encoding オブジェクトを指定します。
@
param option...
...変換オプションをキーワード引数で与えます。
@
return 変換された文字列

変換オプション

: :invalid => nil
変換元のエンコーディングにおいて不正なバイトがあった場合に、例外 Encoding::InvalidByteSequenceError を投げま...
...ようとすると Encoding::UndefinedConversionError が発生する
str = "\u00b7\u2014"
str.encode("Windows-31J", fallback: { "\u00b7" => "\xA5".force_encoding("Windows-31J"),
"\u2014" => "\x81\x5C".force_encoding("Windows-31J") })
//}

@
see String#encode!...
<< 1 2 3 ... > >>