to_f cuts numbers : BigDecimal « Number « Ruby
- Ruby
- Number
- BigDecimal
to_f cuts numbers
require 'bigdecimal'
nm = "0.123456789012345678901234567890123456789"
nm.to_f # => 0.123456789012346
BigDecimal(nm).to_s # => "0.123456789012345678901234567890123456789E0"
Related examples in the same category