BigDecimal#dup() : dup() is a BigDecimal class method which returns the duplicate value for the BigDecimal value.
Syntax: BigDecimal.dup()
Parameter: BigDecimal values to find the duplicate value
Return: duplicate value for the BigDecimal value
Code #1 : Example for dup() method
# Ruby code for dup() method # loading BigDecimal require 'bigdecimal'
# declaring BigDecimal b = -BigDecimal( "10" )
puts "dup example 2 : #{b.dup()}\n\n"
|
Output :
dup example 2 : -0.1E2
Code #2 : Example for dup() method
# Ruby code for dup() method # loading BigDecimal require 'bigdecimal'
# declaring BigDecimal b = BigDecimal( '10' )-( 22 ** 7 . 1 ) ** 10
# declaring BigDecimal c = BigDecimal( '-3' )
puts "dup example 2 : #{b.dup()}\n\n"
puts "dup example 3 : #{c.dup()}\n\n"
|
Output :
dup example 2 : -0.20512110073058639999999999999999999999999999999999999999999999999999999999999999999999999999999E96
dup example 3 : -0.3E1