Ruby | Numeric arg() function Last Updated : 19 Mar, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report 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. . Example 1: Ruby # Ruby program for arg() method in Numeric # Initialize a number num = -19 # Prints arg() of num puts num.arg() Output: 3.141592653589793 Example 2: Ruby # Ruby program for arg() method in Numeric # Initialize a number num = 100 # Prints arg() of num puts num.arg() Output: 0 Comment More infoAdvertise with us Next Article Ruby | Numeric arg() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Numeric-class Similar Reads 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 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 dup() function The dup() is an inbuilt method in Ruby returns the number itself. Syntax: num1.dup() Parameters: The function needs a number. Return Value: It returns itself only. Example 1:  Ruby # Ruby program for dup() method in Numeric # Initialize a number num1 = 1.7 # Function used num = num1.dup() # Prints 1 min read Like