るりまサーチ

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

別のキーワード

  1. math log
  2. math sqrt
  3. _builtin math
  4. bigdecimal/math e
  5. bigdecimal/math pi

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Float (38028.0)

浮動小数点数のクラス。Float の実装は C 言語の double で、その精度は環 境に依存します。

...浮動小数点数のクラス。Float の実装は C 言語の double で、その精度は環
境に依存します。

一般にはせいぜい15桁です。詳しくは多くのシステムで採用されている
浮動小数点標準規格、IEEE (Institute of Electrical and
Electronics Engine...
...電子技術者協会) 754 を参照してください。

//emlist[あるシステムでの 1/3(=0.333...) の結果][ruby]{
printf("%.50f\n", 1.0/3)
# => 0.33333333333333331482961625624739099293947219848633
//}

Math
::PI などの数学定数については Math
参照してください。...

Math.#log(x) -> Float (21168.0)

x の対数(logarithm)を返します。

...x の対数(logarithm)を返します。

引数 x, b の両方に 0 を指定した場合は Float::NAN を返します。

@param x 正の実数を指定します。

@param b 底を指定します。省略した場合は自然対数(natural logarithm)を計算します。

@raise TypeErr...
...らかに負の数を指定した場合に発生します。

//emlist[例][ruby]{
Math
.log(0) # => -Infinity
Math
.log(1) # => 0.0
Math
.log(Math::E) # => 1.0
Math
.log(Math::E**3) # => 3.0
Math
.log(12, 3) # => 2.2618595071429146
//}

@see Math.#log2, Math.#log10, Math.#exp...

Math.#log(x, b) -> Float (21168.0)

x の対数(logarithm)を返します。

...x の対数(logarithm)を返します。

引数 x, b の両方に 0 を指定した場合は Float::NAN を返します。

@param x 正の実数を指定します。

@param b 底を指定します。省略した場合は自然対数(natural logarithm)を計算します。

@raise TypeErr...
...らかに負の数を指定した場合に発生します。

//emlist[例][ruby]{
Math
.log(0) # => -Infinity
Math
.log(1) # => 0.0
Math
.log(Math::E) # => 1.0
Math
.log(Math::E**3) # => 3.0
Math
.log(12, 3) # => 2.2618595071429146
//}

@see Math.#log2, Math.#log10, Math.#exp...

Math.#log2(x) -> Float (21143.0)

2 を底とする x の対数(binary logarithm)を返します。

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

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

//emlist[例][ruby]{
Math
.log2(1) # => 0.0
Math
.log2(2) # => 1.0
Math
.log2(32768) # => 15.0
Math
.log2(65536)...
...# => 16.0
//}

@see Math.#log, Math.#log10...

Math.#log10(x) -> Float (21137.0)

x の常用対数(common logarithm)を返します。

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

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

//emlist[例][ruby]{
Math
.log10(1) # => 0.0
Math
.log10(10) # => 1.0
Math
.log10(10**100) # => 100.0
//}

@see Math....
...#log, Math.#log2...

絞り込み条件を変える

Float#round(ndigits = 0) -> Integer | Float (21126.0)

自身ともっとも近い整数もしくは実数を返します。

...合発生します。

//emlist[例][ruby]{
1.0.round # => 1
1.2.round # => 1
(-1.2).round # => -1
(-1.5).round # => -2

t = Math::PI # => 3.141592653589793
t.round(3) # => 3.142
t.round(0) # => 3
t.round(1) # => 3.1

t = t**10 # => 93648.04747608298
t.round(-0)...
...d(-2) # => 93600
t.round(-3) # => 94000
t.round(-100) # => 0

2.5.round(half: :up) # => 3
2.5.round(half: :even) # => 2
2.5.round(half: :down) # => 2
3.5.round(half: :up) # => 4
3.5.round(half: :even) # => 4
3.5.round(half: :down) # => 3
//}

@see Float#ceil, Float#floor, Float#truncate...

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

自身ともっとも近い整数もしくは実数を返します。

...合発生します。

//emlist[例][ruby]{
1.0.round # => 1
1.2.round # => 1
(-1.2).round # => -1
(-1.5).round # => -2

t = Math::PI # => 3.141592653589793
t.round(3) # => 3.142
t.round(0) # => 3
t.round(1) # => 3.1

t = t**10 # => 93648.04747608298
t.round(-0)...
...d(-2) # => 93600
t.round(-3) # => 94000
t.round(-100) # => 0

2.5.round(half: :up) # => 3
2.5.round(half: :even) # => 2
2.5.round(half: :down) # => 2
3.5.round(half: :up) # => 4
3.5.round(half: :even) # => 4
3.5.round(half: :down) # => 3
//}

@see Float#ceil, Float#floor, Float#truncate...

Float#round(ndigits = 0) -> Integer | Float (21125.0)

自身ともっとも近い整数もしくは実数を返します。

...t = Math::PI # => 3.141592653589793
t.round(3) # => 3.142
t.round(0) # => 3
t.round(1) # => 3.1

t = t**10 # => 93648.04747608298
t.round(-0) # => 93648
t.round(-1) # => 93650
t.round(-2) # => 93600
t.round(-3) # => 94000
t.round(-100) # => 0
//}

@see Float#ceil, Float#flo...

Math.#acos(x) -> Float (21125.0)

x の逆余弦関数(arccosine)の値をラジアンで返します。

...定した場合に発生します。

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

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

//emlist[例][ruby]{
Math
.acos(0) == Math::PI/2 # => true
//}

@see Math.#cos...

Math.#asin(x) -> Float (21125.0)

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

...定した場合に発生します。

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

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

//emlist[例][ruby]{
Math
.asin(1) == Math::PI/2 # => true
//}

@see Math.#sin...

絞り込み条件を変える

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

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

...list[例][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...
<< 1 2 3 ... > >>