るりまサーチ (Ruby 2.7.0)

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.200秒)
トップページ > 種類:インスタンスメソッド[x] > クエリ:l[x] > バージョン:2.7.0[x] > クエリ:p[x] > クエリ:raise[x] > クエリ:-[x] > クラス:Float[x]

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. matrix p
  5. rsa p

ライブラリ

キーワード

検索結果

Float#to_d(prec) -> BigDecimal (9997.0)

自身を BigDecimal に変換します。

...自身を BigDecimal に変換します。

@param prec 計算結果の精度。省略した場合は Float::DIG + 1 です。

@return BigDecimal に変換したオブジェクト

//emlist[][ruby]{
require 'bigdecimal'
require 'bigdecimal/util'

p 1.0.to_d # => 0.1e1
p (1.0 / 0).to_d # => I...

Float#round(ndigits = 0, half: :up) -> Integer | Float (9979.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#to_d -> BigDecimal (9697.0)

自身を BigDecimal に変換します。

...自身を BigDecimal に変換します。

@param prec 計算結果の精度。省略した場合は Float::DIG + 1 です。

@return BigDecimal に変換したオブジェクト

//emlist[][ruby]{
require 'bigdecimal'
require 'bigdecimal/util'

p 1.0.to_d # => 0.1e1
p (1.0 / 0).to_d # => I...