Ruby | BigDecimal precs function
BigDecimal#precs() : precs() is a BigDecimal class method which checks whether the BigDecimal value is nan value.
Syntax: BigDecimal.precs()
Parameter: BigDecimal values to check regarding the NaN value.
Return: true : if value is a NaN value otherwise return false
Example #1 :
require 'bigdecimal'
a = BigDecimal( '2' )
b = BigDecimal( "100" )
c = BigDecimal( "10 * 20" )
puts "precs example 1 : #{a.precs()}\n\n"
puts "precs example 2 : #{b.precs()}\n\n"
|
Output :
precs example 1 : [9, 18]
precs example 2 : [9, 18]
Example #2 :
require 'bigdecimal'
c = BigDecimal( "10 * 20" )
puts "precs example 2 : #{c.precs()}\n\n"
|
Output :
precs example 2 : [9, 18]
Last Updated :
05 Dec, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...