BigDecimal#precs() : precs() is a BigDecimal class method which checks whether the BigDecimal value is nan value.
Ruby
Output :
Ruby
Output :
Syntax: BigDecimal.precs() Parameter: BigDecimal values to check regarding the NaN value. Return: true : if value is a NaN value otherwise return falseExample #1 :
# Ruby code for precs() method
# loading BigDecimal
require 'bigdecimal'
# declaring BigDecimal
a = BigDecimal('2')
# declaring BigDecimal
b = BigDecimal("100")
# declaring BigDecimal
c = BigDecimal("10 * 20")
# precs() method
puts "precs example 1 : #{a.precs()}\n\n"
puts "precs example 2 : #{b.precs()}\n\n"
precs example 1 : [9, 18] precs example 2 : [9, 18]Example #2 :
# Ruby code for precs() method
# loading BigDecimal
require 'bigdecimal'
# declaring BigDecimal
c = BigDecimal("10 * 20")
# precs() method
puts "precs example 2 : #{c.precs()}\n\n"
precs example 2 : [9, 18]