るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
6件ヒット [1-6件を表示] (0.030秒)
トップページ > バージョン:2.6.0[x] > クエリ:Float[x] > クエリ:Infinity[x] > クエリ:bigdecimal[x]

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

bigdecimal (116137.0)

bigdecimal は浮動小数点数演算ライブラリです。 任意の精度で 10 進表現された浮動小数点数を扱えます。

bigdecimal は浮動小数点数演算ライブラリです。
任意の精度で 10 進表現された浮動小数点数を扱えます。

//emlist[][ruby]{
require 'bigdecimal'
a = BigDecimal("0.123456789123456789")
b = BigDecimal("123456.78912345678", 40)
print a + b # => 0.123456912580245903456789e6
//}

一般的な 10 進数の計算でも有用です。2 進数の浮動小数点演算には微小な誤
差があるのに対し、BigDecimal では正確な値を得る事がで...

Float#to_d -> BigDecimal (63445.0)

自身を BigDecimal に変換します。

自身を BigDecimal に変換します。

@param prec 計算結果の精度。省略した場合は Float::DIG + 1 です。

@return BigDecimal に変換したオブジェクト

//emlist[][ruby]{
require 'bigdecimal'
require 'bigdecimal/util'

p 1.0.to_d # => 0.1e1
p (1.0 / 0).to_d # => Infinity

p (1.0 / 3).to_d / (2.0 / 3).to_d # => 0.5e0
p ((1.0 / 3) / (2.0 / 3...

Float#to_d(prec) -> BigDecimal (63445.0)

自身を BigDecimal に変換します。

自身を BigDecimal に変換します。

@param prec 計算結果の精度。省略した場合は Float::DIG + 1 です。

@return BigDecimal に変換したオブジェクト

//emlist[][ruby]{
require 'bigdecimal'
require 'bigdecimal/util'

p 1.0.to_d # => 0.1e1
p (1.0 / 0).to_d # => Infinity

p (1.0 / 3).to_d / (2.0 / 3).to_d # => 0.5e0
p ((1.0 / 3) / (2.0 / 3...

Integer#**(other) -> Numeric (109.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 (109.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, modulo) -> Integer (109.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
...