Ruby | Numeric angle() function Last Updated : 19 Mar, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report 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. . Example 1: Ruby # Ruby program for angle() method in Numeric # Initialize a number num = -19 # Prints angle() of num puts num.angle() Output: 3.141592653589793 Example 2: Ruby # Ruby program for angle() method in Numeric # Initialize a number num = 100 # Prints angle() of num puts num.angle() Output: 0 Comment More infoAdvertise with us Next Article Ruby | Numeric angle() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Numeric-class Similar Reads 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 abs() function 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 # I 1 min read 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 i() function The i() is an inbuilt method in Ruby returns a complex number with the imaginary part that is given. Syntax: num.i() Parameters: The function needs a number which is the imaginary part of the complex number. Return Value: It returns a complex number with the imaginary part. Example 1: CPP # Ruby pro 1 min read Ruby | Numeric coerce() function The coerce() is an inbuilt method in Ruby returns an array containing two numbers containing two float numbers. Syntax: num1.coerce(num2) Parameters: The function needs a number and ndigits to which the precision of decimal digits is kept. In case no ndigits is passed it takes 0 to be the default v 1 min read Like