Ruby | BigDecimal class clone value
BigDecimal#clone() : clone() is a BigDecimal class method which returns the clone value for the BigDecimal value.
Syntax: BigDecimal.clone()
Parameter: BigDecimal values to find the clone value
Return: clone value for the BigDecimal value
Code #1 : Example for clone() method
require 'bigdecimal'
b = -BigDecimal( "10" )
puts "clone example 2 : #{b.clone()}\n\n"
|
Output :
clone example 2 : -0.1E2
Code #2 : Example for clone() method
require 'bigdecimal'
b = BigDecimal( '10' )-( 22 ** 7 . 1 ) ** 10
c = BigDecimal( '-3' )
puts "clone example 2 : #{b.clone()}\n\n"
puts "clone example 3 : #{c.clone()}\n\n"
|
Output :
clone example 2 : -0.20512110073058639999999999999999999999999999999999999999999999999999999999999999999999999999999E96
clone example 3 : -0.3E1
Last Updated :
08 Jan, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...