Ruby | Float numerator() method Last Updated : 07 Jan, 2020 Comments Improve Suggest changes Like Article Like Report Float numerator() is a float class method which return a float value as the numerator value for p/q form. Syntax:float.numerator() Parameter: float value (p) for the p/q form. [Always positive] Return: A machine-dependent result. Example #1: Ruby # Ruby program for numerator() method a = 2.0.numerator() # Returning machine dependent result puts "numerator : #{a}\n\n" # Using as a numerator puts "Division int/float : #{a.fdiv(4)}\n\n" puts "Division float/float : #{a.fdiv(4.0)}\n\n" Output : numerator : 2 Division int/float : 0.5 Division float/float : 0.5 Example #2: Ruby # Ruby program for numerator() method # Initializing value a = 0.numerator() # returning machine dependent result puts "numerator : #{a}\n\n" puts "Division int/float : #{a.fdiv(4)}\n\n" puts "Division float/float : #{a.fdiv(4.0)}\n\n" Output : numerator : 0 Division int/float : 0.0 Division float/float : 0.0 Comment More infoAdvertise with us Next Article Ruby | Float numerator() method M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby Float-class Similar Reads Ruby | Numeric - method The - is an inbuilt method in Ruby returns the subtraction of two numbers. It returns a - b. Syntax: a - b Parameters: The function needs two number whose subtraction is returned. Return Value: It returns the subtraction of two numbers. Example 1: Ruby # Ruby program for - method in Numeric # Init 1 min read Ruby | Float eql() method 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 1 min read 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 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 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 Like