Ruby | Numeric abs() function Last Updated : 19 Mar, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The abs is an inbuilt method in Ruby returns the absolute value of a number. Syntax: num.abs Parameters: The function needs the number whose absolute value is to be returned. Return Value: It returns the absolute value of a numbers. Example 1: Ruby # Ruby program for abs() method in Numeric # Initialize two numbers num = -19 # Prints absolute value of num puts num.abs() Output: 19 Example 2: Ruby # Ruby program for abs() method in Numeric # Initialize two numbers num = 100 # Prints absolute value of num puts num.abs() Output: 100 Comment More infoAdvertise with us Next Article Ruby | Numeric abs() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Numeric-class Similar Reads Ruby | Numeric abs2() function The abs2() is an inbuilt method in Ruby returns the square of a number. Syntax: num.abs2 Parameters: The function needs the number whose square is to be returned. Return Value: It returns the square of a number. Example 1:  Ruby # Ruby program for abs2() method in Numeric # Initialize a number nu 1 min read Ruby | Numeric arg() function The arg() is an inbuilt method in Ruby returns 0 if the number is positive, else it returns a float value which is equal to pi. Syntax: num.arg() Parameters: The function needs a number. Return Value: It returns 0 if the number is positive, else it returns a float value which is equal to pi. . Exa 1 min read Ruby | Numeric angle() function The angle() is an inbuilt method in Ruby returns 0 if the number is positive, else it returns a float value which is equal to pi. Syntax: num.angle() Parameters: The function needs a number. Return Value: It returns 0 if the number is positive, else it returns a float value which is equal to pi. . 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 Ruby | Numeric div() function The div() is an inbuilt method in Ruby that returns the result after performing an integer division. Syntax: num1.div(num2) Parameters: The function needs two numbers whose integer division is to be performed. Return Value: It returns returns the integer division.Example 1: CPP #Ruby program for div 1 min read Like