Ruby | Numeric rectangular() function Last Updated : 12 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The rectangular() is an inbuilt method in Ruby returns an array which consists of a real and an imaginary number. Syntax: num.rectangular() Parameters: The function needs the number whose real and imaginary part is returned. Return Value: It returns an array which consists of a real and an imaginary number. Example 1: Ruby # Ruby program for rectangular() # method in Numeric # Initialize a number num = Complex(10, 6) # Prints the rectangular part puts num.rectangular() Output: 10 6 Example 2: Ruby # Ruby program for rectangular() # method in Numeric # Initialize a number num = Complex(18, 16) # Prints the rectangular part puts num.rectangular() Output: 18 16 Comment More infoAdvertise with us Next Article Ruby | Numeric real? function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Numeric-class Similar Reads Ruby | Matrix rectangular() function The rectangular() is an inbuilt method in Ruby returns two matrix. The first matrix returned has all the real values of the matrix, and the second matrix has all the imaginary values in the matrix. Syntax: mat1.rectangular() Parameters: The function needs the matrix whose real and imaginary values a 1 min read Ruby | Numeric rect() function The rect() is an inbuilt method in Ruby returns an array which consists of a real and an imaginary number. Syntax: num.rect() Parameters: The function needs the number whose real and imaginary part is returned. Return Value: It returns an array which consists of a real and an imaginary number. Examp 1 min read Ruby | Numeric real? function The real?() is an inbuilt method in Ruby returns a boolean value. It returns true if the number is a negative one, else it returns false. Syntax: num.real?() Parameters: The function needs a number which is to be checked for. Return Value: It returns returns a boolean value. Example 1: CPP # Ruby pr 1 min read Ruby | Numeric real() function The real() is an inbuilt method in Ruby returns the real part of the given number. Syntax: num.real() Parameters: The function needs the number whose real part is to be returned. Return Value: It returns the real part of the complex number. Example 1: Ruby # Ruby program for real() # method in Numer 1 min read Ruby | Numeric remainder() function The remainder() is an inbuilt method in Ruby returns the remainder when num1 is divided by num2. Syntax: num1.remainder(num2) Parameters: The function needs num1 and num2 which are to be divided. Return Value: It returns the remainder. Example 1: Ruby # Ruby program for remainder() # method in Numer 1 min read Ruby | Numeric round() function The round() is an inbuilt method in Ruby returns a number rounded to a number nearest to the given number with a precision of the given number of digits after the decimal point. In case the number of digits is not given, the default value is taken to be zero. Syntax: num.round(ndigits) Parameters: T 1 min read Like