るりまサーチ

最速Rubyリファレンスマニュアル検索!
89件ヒット [1-89件を表示] (0.137秒)
トップページ > クエリ:E[x] > クエリ:sqrt[x]

別のキーワード

  1. open3 popen2e
  2. socket af_e164
  3. matrix det_e
  4. matrix rank_e
  5. open3 capture2e

ライブラリ

クラス

モジュール

キーワード

検索結果

Integer.sqrt(n) -> Integer (21255.0)

非負整数 n の整数の平方根を返します。すなわち n の平方根以下の 最大の非負整数を返します。

...Integer ではない場合は、最初に Integer に変換されます。
@raise Math::DomainError n が負の整数の時に発生します。

//emlist[][ruby]{
Integer.sqrt(0) # => 0
Integer.sqrt(1) # => 1
Integer.sqrt(24) # => 4
Integer.sqrt(25) # => 5
Integer.sqrt(10*...
...*400) == 10**200 # => true
//}

Math.sqrt(n).floor と同等ですが、後者は浮動小数点数の精度の限界によって
真の値とは違う結果になることがあります。

//emlist[][ruby]{
Integer.sqrt(10**46) #=> 100000000000000000000000
Math.sqrt(10**46).floor #=> 999999...
...99999999991611392 (!)
//}


@see Math.#sqrt...

BigDecimal#sqrt(n) -> BigDecimal (21201.0)

self の有効桁 n 桁の平方根 (n の平方根ではありません) をニュートン法で 計算します。

...self の有効桁 n 桁の平方根 (n の平方根ではありません) をニュートン法で
計算します。

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

@raise ArgumentError n に負の数を指定した場合に発生します。...

BigMath.#sqrt(x, prec) -> BigDecimal (18313.0)

x の平方根を prec で指定した精度で計算します。

...x の平方根を prec で指定した精度で計算します。

@param x 平方根を求める数。

@param prec 計算結果の精度。

@raise FloatDomainError x に 0 以下、もしくは NaN が指定された場合に発生します。

@raise ArgumentError prec に 0 未満が指定さ...
...れた場合に発生します。

//emlist[][ruby]{
require "bigdecimal/math"

puts BigMath::sqrt(BigDecimal('2'), 10) #=> 0.1414213562373095048666666667e1
//}...

CMath.#sqrt(z) -> Float | Complex (18219.0)

z の平方根を返します。

...z の平方根を返します。

@param z 数値

@raise TypeError z に数値以外を指定した場合に発生します。

//emlist[例][ruby]{
require "cmath"
CMath.sqrt(-1) # => (0+1.0i)
CMath.sqrt(1)# => 1.0
CMath.sqrt(Complex(0, 8))# => (2.0+2.0i)
//}...

Math.#sqrt(a) -> Numeric (18201.0)

@todo

...@todo

a の正の平方根を返します。
a が Complex の時は、Complex を返します。
a が負の時は、a を正にして、その平方根を Complex の虚数部に入れて返します。
それ以外は、Math.rsqrt の結果を返します。...

絞り込み条件を変える

Math.#rsqrt(a) -> Numeric (6200.0)

@todo

...@todo

複素数を考慮しないので、負の数や Complex をあたえないでください。

a が Float の時は、Float を返します。
それ以外の時、平方根が有理数であれば、Rational または Integer を返します。
無理数であれば、Float を返します...

CMath.#exp!(x) -> Float (6146.0)

実数 x の指数関数(Math::E の x 乗)の値を返します。 Math.#exp のエイリアスです。

...実数 x の指数関数(Math::E の x 乗)の値を返します。
Math.#exp のエイリアスです。

@param x Math::E を x 乗する数を実数で指定します。

@raise TypeError x に数値以外を指定した場合に発生します。

@raise RangeError x に実数以外の数値を...
...指定した場合に発生します。

//emlist[例][ruby]{
require "cmath"
CMath.exp!(0) # => 1
CMath.exp!(0.5) # => Math.sqrt(Math::E)
CMath.exp!(1) # => Math::E
CMath.exp!(2) # => Math::E ** 2
//}

@see Math.#exp...

Complex#magnitude -> Numeric (6106.0)

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

...す。

以下の計算の結果を Float オブジェクトで返します。

sqrt
(self.real ** 2 + self.imag ** 2)

//emlist[例][ruby]{
Complex(1, 2).abs # => 2.23606797749979
Complex(3, 4).abs # => 5.0
Complex('1/2', '1/2').abs # => 0.7071067811865476
//}

@see Complex#abs2...

bigdecimal/math (6018.0)

BigDecimalを使った数学的な機能を提供します。

...gDecimalを使った数学的な機能を提供します。

以下の計算が行えます。

* sqrt(x, prec)
* sin (x, prec)
* cos (x, prec)
* atan(x, prec)
* PI (prec)
* E (prec)

引数:

: x

計算対象の BigDecimal オブジェクト。

: prec

計算結果の精度。

//eml...
...ist[例][ruby]{
require "bigdecimal"
require "bigdecimal/math"

include BigMath

a = BigDecimal((PI(100)/2).to_s)
puts sin(a,100)
#=> 0.99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998765917571575217785e0
//}...

NEWS for Ruby 2.5.0 (6006.0)

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

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

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...トは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。

== 2.4.0 以降の変更

=== 言語仕様の変更

* トップレベルの定数参照を削除しました 11547
* do/end ブロック内部で rescue/else/ensure を書けるようになりまし...
...Integer
* Integer#round, Integer#floor, Integer#ceil, Integer#truncate は常に Integer を返すようになりました
13420
* Integer#pow を追加 12508 11003
* Integer#allbits?, Integer#anybits?, Integer#nobits? を追加 12753
* Integer.sqrt を追加 13219

* Kernel...

絞り込み条件を変える

Complex#abs -> Numeric (3106.0)

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

...す。

以下の計算の結果を Float オブジェクトで返します。

sqrt
(self.real ** 2 + self.imag ** 2)

//emlist[例][ruby]{
Complex(1, 2).abs # => 2.23606797749979
Complex(3, 4).abs # => 5.0
Complex('1/2', '1/2').abs # => 0.7071067811865476
//}

@see Complex#abs2...