Ruby | Float eql() method Last Updated : 08 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report eql() is a float class method which checks whether two values are equal. Syntax: float.eql() Parameter: float values which is to be checked Return: Boolean value return true if values are equal otherwise return false Example #1 : Ruby # Ruby code for equal() method # Declaring float value a = -100.7 # Declaring float value b = -100.70 # Declaring float value c = 100.7 # Check array equality puts "a = b : #{a.eql?(b)}\n\n" # Check array equality puts "b = c : #{b.eql?(c)}\n\n" # Check array equality puts "c = b : #{c.eql?(b)}\n\n" Output : a = b : true b = c : false c = b : false Example #2 : Ruby # Ruby code for equal() method # declaring float value a = 10070 # Declaring float value b = 10070 # Declaring float value c = 10070.0 # Check array equality puts "a = b : #{a.eql?(b)}\n\n" # Check array equality puts "b = c : #{b.eql?(c)}\n\n" # Check array equality puts "c = b : #{c.eql?(b)}\n\n" Output : a = b : true b = c : false c = b : false Comment More infoAdvertise with us Next Article Ruby | Float eql() method M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby Float-class Similar Reads Ruby | Float to_i() method Float#to_i() is a float class method which return a Integer representation of the float value. Syntax: float.to_i() Parameter: float value as argument Return: Integer representation of the float value. Example #1 : Ruby # Ruby code for to_i() method # declaring float value a = 0.756567 # declaring f 1 min read Ruby Float quo() method with example Float quo() is a float class method which return the quotient value of the division. Syntax: float.quo() Parameter: float values - dividend and divisor Return: Quotient value of the division. Example #1: Ruby # Ruby code for quo() method # Initializing value a = 4.0 b = 2.0 # Printing result puts 1 min read Ruby Float arg() method with example Float arg() is a float class method which works on float values and works differently for both positive and negative values. Syntax: float.arg() Parameter: float value which is to be checked Return: return 0 for positive values. Otherwise pi(3.141592653589793) Example #1: Ruby # Ruby code for arg() 1 min read Ruby Float nan?() method with example 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 # Ru 1 min read Ruby Float to_r() method with example Float to_r() is a float class method which return a rational form of the float value. Syntax: float.to_r() Parameter: float value as argument Return: Rational form representation of the float value. Example #1 : Ruby # Ruby code for to_r() method # Initializing values a = 2.0 b = 9.99991 # Printing 1 min read Like