るりまサーチ (Ruby 2.4.0)

最速Rubyリファレンスマニュアル検索!
6件ヒット [1-6件を表示] (0.203秒)
トップページ > バージョン:2.4.0[x] > ライブラリ:ビルトイン[x] > クエリ:_builtin[x] > クエリ:PI[x] > クラス:Float[x]

別のキーワード

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

キーワード

検索結果

Float#hash -> Integer (24118.0)

ハッシュ値を返します。

ハッシュ値を返します。

//emlist[例][ruby]{
pi1 = 3.14
pi2 = 3.14
pi3 = 3.1415

pi1.hash # => 335364239
pi2.hash # => 335364239
pi3.hash # => 420540030
//}

Float#angle -> 0 | Float (24058.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 (24058.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 (24058.0)

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

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

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

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

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