ruby get decimal
# Step 1: Require the BigDecimal library
require 'bigdecimal'
# Step 2: Define a method to get the decimal representation
def get_decimal(value)
# Step 3: Convert the input value to a BigDecimal object
decimal_value = BigDecimal(value)
# Step 4: Return the decimal representation
return decimal_value
end
# Step 5: Example usage
input_value = "123.456"
result = get_decimal(input_value)
# Step 6: Print the result
puts result