るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Float (46024.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 を
参照してください。...

Float#round(ndigits = 0) -> Integer | Float (29128.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 (29128.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 (29127.0)

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

...::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#floor, Float#...

Float#angle -> 0 | Float (29121.0)

自身の偏角(正の数なら 0、負の数なら Math::PI)を返します。

...自身の偏角(正の数なら 0、負の数なら Math::PI)を返します。

//emlist[例][ruby]{
1.arg # => 0
-1.arg # => 3.141592653589793
//}

ただし、自身が NaN(Not a number) であった場合は、NaN を返します。...

絞り込み条件を変える

Float#arg -> 0 | Float (29121.0)

自身の偏角(正の数なら 0、負の数なら Math::PI)を返します。

...自身の偏角(正の数なら 0、負の数なら Math::PI)を返します。

//emlist[例][ruby]{
1.arg # => 0
-1.arg # => 3.141592653589793
//}

ただし、自身が NaN(Not a number) であった場合は、NaN を返します。...

Float#phase -> 0 | Float (29121.0)

自身の偏角(正の数なら 0、負の数なら Math::PI)を返します。

...自身の偏角(正の数なら 0、負の数なら Math::PI)を返します。

//emlist[例][ruby]{
1.arg # => 0
-1.arg # => 3.141592653589793
//}

ただし、自身が NaN(Not a number) であった場合は、NaN を返します。...

Float#hash -> Integer (29038.0)

ハッシュ値を返します。

...ハッシュ値を返します。

//emlist[例][ruby]{
pi
1 = 3.14
pi
2 = 3.14
pi
3 = 3.1415

pi
1.hash # => 335364239
pi
2.hash # => 335364239
pi
3.hash # => 420540030
//}...

Math::PI -> Float (26210.0)

円周率

...円周率

//emlist[例][ruby]{
p Math::PI
# => 3.141592654
//}...

Complex#angle -> Float (8111.0)

自身の偏角を[-π,π]の範囲で返します。

...自身の偏角を[-π,π]の範囲で返します。

//emlist[例][ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}

非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。

//emlist[例][ruby]...

絞り込み条件を変える

Complex#arg -> Float (8111.0)

自身の偏角を[-π,π]の範囲で返します。

...自身の偏角を[-π,π]の範囲で返します。

//emlist[例][ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}

非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。

//emlist[例][ruby]...
<< 1 2 > >>