Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Integer#to_d

int.to_d → bigdecimal

Returns the value of int as a BigDecimal.

Example
require 'bigdecimal'
require 'bigdecimal/util'

42.to_d   # => 0.42e2

See also Kernel.BigDecimal.

See also #to_bn #to_f #times #to_i also in 3.2 · 3.1 · 3.0