るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Kernel.#Float(arg) -> Float (24535.0)

引数を浮動小数点数(Float)に変換した結果を返します。

...引数を浮動小数点数(Float)に変換した結果を返します。

引数が数値の場合は素直に変換し、文字列の場合
は整数や浮動小数点数と見なせるもののみ変換します。

メソッド Float は文字列に対し String#to_f よりも厳密な変換を...
...ェクトです。
@raise ArgumentError 整数や浮動小数点数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError nil またはメソッド to_f を持たないオブジェクトを引数に指定したか、
t
o_f が浮動小数点...
.../emlist[例][ruby]{
p Float(4) #=> 4.0
p Float(4_000) #=> 4000.0
p Float(9.88) #=> 9.88

p Float(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (TypeError)

p Float("10"...

Kernel.#Float(arg, exception: true) -> Float | nil (24535.0)

引数を浮動小数点数(Float)に変換した結果を返します。

...引数を浮動小数点数(Float)に変換した結果を返します。

引数が数値の場合は素直に変換し、文字列の場合
は整数や浮動小数点数と見なせるもののみ変換します。

メソッド Float は文字列に対し String#to_f よりも厳密な変換を...
...@param exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。
@raise ArgumentError 整数や浮動小数点数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError nil...
...ッド to_f を持たないオブジェクトを引数に指定したか、
t
o_f が浮動小数点数を返さなかった場合に発生します。

//emlist[例][ruby]{
p Float(4) #=> 4.0
p Float(4_000) #=> 4000.0
p Float(9.88) #=> 9.88

p Float(Time.gm...

CMath.#sqrt!(x) -> Float (6232.0)

実数 x の平方根を返します。Math.#sqrt のエイリアスです。

...数 x の平方根を返します。Math.#sqrt のエイリアスです。

@param x 正の実数

@raise Math::DomainError x が負の数である場合に発生します。

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

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

//emlist[例][ruby]{
require "cmath"
CMath.sqrt!(4.0) # => 2.0
CMath.sqrt!(9.0) # => 3.0
//}

@see Math.#sqrt...

Math.#sqrt(x) -> Float (6232.0)

x の非負の平方根(principal square root)を返します。

...平方根(principal square root)を返します。

@param x 0または正の実数

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

@raise Math::DomainError x に範囲外の実数を指定した場合に発生します。

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

//emlist[例][ruby]{
0.upto(10) {|x|
p [x, Math.sqrt(x), Math.sqrt(x)**2]
}
# => [0, 0.0, 0.0]
# [1, 1.0, 1.0]
# [2, 1.4142135623731, 2.0]
# [3, 1.73205080756888, 3.0]
# [4, 2.0, 4.0]
# [5, 2.23606797749979, 5.0]
# [6, 2.44948974278318, 6....
...0]
# [7, 2.64575131106459, 7.0]
# [8, 2.82842712474619, 8.0]
# [9, 3.0, 9.0]
# [10, 3.16227766016838, 10.0]
//}

@see Integer.sqrt, Math.#cbrt...

CMath.#cbrt!(x) -> Float (6226.0)

実数 x の立方根を返します。Math.#cbrt のエイリアスです。

...Math.#cbrt のエイリアスです。

@param x 実数

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

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

//emlist[例][ruby]{
require "cmath"
CMath.cbrt!(8.0)# => 2.0
CMath.cbrt!(-8....
...0) # => -2.0
//}

@see Math.#cbrt...

絞り込み条件を変える

CMath.#tan!(x) -> Float (6226.0)

実数 x の正接関数の値を返します。Math.#tan のエイリアス です。

...ath.#tan のエイリアス
です。

@param x 実数(ラジアンで与えます)

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

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

//emlist[例][ruby]{
require "cmath"
CMath.ta...
...n!(0 * Math::PI / 4) # => 0.0
CMath.tan!(1 * Math::PI / 4) # => 1.0
CMath.tan!(4 * Math::PI / 4) # => 0.0
//}

@see Math.#tan...

Math.#atan(x) -> Float (6226.0)

x の逆正接関数(arctangent)の値をラジアンで返します。

...x の逆正接関数(arctangent)の値をラジアンで返します。

@param x 実数

@return 返される値の範囲は [-π/2, +π/2] です。

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

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

//emlist[例][ruby]{
Math.atan(0) # => 0.0
//}

@see Math.#atan2, Math.#tan...

Math.#atan2(y, x) -> Float (6226.0)

y / x の逆正接関数(arctangent)の値をラジアンで返します。

...逆正接関数(arctangent)の値をラジアンで返します。

@param y 実数
@param x 実数

@return 返される値の範囲は [-π, π] です。


//emlist[例][ruby]{
Math.atan2(1,0) #=> 1.5707963267949
Math.atan2(-1,0) #=> -1.5707963267949
//}

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

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

@see Math.#atan, Math.#tan...

Math.#cbrt(x) -> Float (6226.0)

x の立方根(cubic root)を返します。

...(cubic root)を返します。

@param x 実数

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

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

//emlist[例][ruby]{
-9.upto(9) {|x|
p [x, Math.cbrt(x), Math.cbrt(x)**3]
}
# =>...
....0, -1.0]
# [0, 0.0, 0.0]
# [1, 1.0, 1.0]
# [2, 1.25992104989487, 2.0]
# [3, 1.44224957030741, 3.0]
# [4, 1.5874010519682, 4.0]
# [5, 1.7099759466767, 5.0]
# [6, 1.81712059283214, 6.0]
# [7, 1.91293118277239, 7.0]
# [8, 2.0, 8.0]
# [9, 2.0800838230519, 9.0]
//}

@see Math.#sqrt...

Math.#hypot(x, y) -> Float (6226.0)

sqrt(x*x + y*y) を返します。

...sqrt(x*x + y*y) を返します。

この値は x, y を直交する 2 辺とする直角三角形の斜辺(hypotenuse)の長さです。

@param x 実数
@param y 実数

@raise TypeError 引数のどちらかに数値以外を指定した場合に発生します。

@raise RangeError 引数...
...のどちらかに実数以外の数値を指定した場合に発生します。

//emlist[例][ruby]{
Math.hypot(3, 4) #=> 5.0
//}...

絞り込み条件を変える

Math.#tan(x) -> Float (6226.0)

x の正接関数(tangent)の値を返します。

...tangent)の値を返します。

@param x 実数(ラジアンで与えます)

@return 実数

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

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

//emlist[例][ruby]{
Math.tan...
...(0) # => 0.0
//}

@see Math.#atan, Math.#atan2...
<< 1 2 3 ... > >>