Ruby | Numeric - method Last Updated : 18 Jan, 2021 Comments Improve Suggest changes Like Article Like Report 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 # Initialize two numbers a = 19 b = 4 # Prints a - b puts a - b Output: 15 Example 2: Ruby # Ruby program for - method in Numeric # Initialize two numbers a = 13 b = 2 # Prints a - b puts a - b Output: 1q Comment More infoAdvertise with us Next Article Ruby | Numeric - method G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Numeric-class Similar Reads Ruby | Numeric + method The + is an inbuilt method in Ruby returns the addition of two numbers. It returns a + b. Syntax: a + b Parameters: The function needs two number whose addition is returned. Return Value: It returns the addition of two numbers. Example 1: Ruby # Ruby program for + method in Numeric # Initialize tw 1 min read Ruby | Numeric method The <=> is an inbuilt method in Ruby, which returns 0 if both the numbers are equal, else it returns 1. Syntax: a <=> b Parameters: The function needs two number whose comparison is to be done. Return Value: It returns 0 if both the numbers are same, else it returns 1. Example 1:  Rub 1 min read Ruby | Numeric % method The % is an inbuilt method in Ruby returns the modular value when two numbers are divided. It returns the value of a % b. Syntax: a % b Parameters: The function needs two number whose modulus on division is returned. Return Value: It returns the modulus when two numbers are divided. Example 1:  R 1 min read Ruby | Float numerator() method 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.numerat 1 min read Ruby | Numeric eql?() function The eql?() is an inbuilt method in Ruby returns a boolean value. It returns true if both the numbers are equal, else it returns false. Syntax: num1.eql?(num2) Parameters: The function needs two number whose comparison is to be done. Return Value: It returns returns true if both are equal, else it r 1 min read Like