.to_s("F") : BigDecimal « Number « Ruby
- Ruby
- Number
- BigDecimal
.to_s("F")
require 'bigdecimal'
(a = BigDecimal("2.01")).precs # => [8, 8]
(b = BigDecimal("3.01")).precs # => [8, 8]
(product = a * b).to_s("F") # => "6.0501"
product.precs # => [8, 24]
Related examples in the same category