Ruby Float nan?() method with example Last Updated : 13 Jan, 2022 Comments Improve Suggest changes Like Article Like Report Float nan?() is a float class method that checks whether the value is 'not a number'. 'Not A Number' means an invalid IEEE floating-point number. Syntax: float.nan?()Parameter: float value to be passedReturn: Return true - if the value is 'not a number' otherwise return false Example #1: Ruby # Ruby program for nan?() method # Initializing value a = 0.0 b = 0.0.modulo(4.0) # Printing result puts "a is not_a_number : #{a.nan?}\n\n" puts "b is not_a_number : #{b.nan?}\n\n" Output : a is not_a_number : false b is not_a_number : false Example #2: Ruby # Ruby program for nan?() method # Initializing value a = 26.00 b = 8.0 # Printing Result puts "a is not_a_number : #{a.nan?}\n\n" puts "b is not_a_number : #{b.nan?}\n\n" Output : a is not_a_number : false b is not_a_number : false Comment More infoAdvertise with us Next Article Ruby Float nan?() method with example M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby Float-class Similar Reads Ruby Float negative() method with example Float negative() is a float class method which checks whether the float value is negative. Syntax: float.negative() Parameter: float value which is to be checked Return: Boolean value return false - if value is positive and return true - if value is negative Example #1: Ruby # Ruby code for negative 1 min read Ruby Float zero?() method with example Float#zero() : zero() is a float class method which checks whether the float value is zero. Syntax: float.zero() Parameter:float value which is to be checked Return: Boolean value return true if value is zero otherwise return false Example #1: Ruby # Ruby code for zero?() method # Initializing value 1 min read Ruby Float angle() method with example Float angle() is a float class method which works on float values and works differently for both positive and negative values. Syntax: float.angle() Parameter: float value which is to be checked Return: 0 for positive values Otherwise pi(3.141592653589793) Example #1 : Ruby # Ruby code for angle() m 1 min read Ruby Float positive() method with example Float positive() is a float class method which checks whether the float value is positive. Syntax: float.positive() Parameter: float value which is to be checked Return: Boolean value return true - if value is positive or return false - if value is negative Example #1:Â Ruby # Ruby program for posit 1 min read Ruby Float denominator() method with example Float#denominator() : denominator() is a float class method which return a float value as the denominator value for p/q form. Syntax: float.denominator() Parameter: float value (q) for the p/q form. [Always positive] Return: A machine-dependent result. Example #1: Ruby # Ruby code for denominator() 1 min read Like