Skip to content

Tag Archives: Ruby Numeric-class

The <=> is an inbuilt method in Ruby, which returns 0 if both the numbers are equal, else it returns 1.  Syntax: a <=> b … Read More
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… Read More
The magnitude() is an inbuilt method in Ruby returns the magnitude of a number.  Syntax: num.magnitude Parameters: The function needs the number whose magnitude is… Read More
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… Read More
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… Read More
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… Read More
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… Read More
The conj() is an inbuilt method in Ruby returns the number itself.  Syntax: num1.conj() Parameters: The function needs a number.  Return Value: It returns itself… Read More
The conjugate() is an inbuilt method in Ruby returns the number itself. Syntax: num1.conjugate() Parameters: The function needs a number. Return Value: It returns itself… Read More
The denominator() is an inbuilt method in Ruby returns the denominator of the number. Syntax: num1.denominator() Parameters: The function needs a number whose denominator is… Read More
The div() is an inbuilt method in Ruby returns the result after performing an integer division. Syntax: num1.div(num2) Parameters: The function needs two numbers whose… Read More
The divmod() is an inbuilt method in Ruby returns the integer quotient and modulus after performing the division. Syntax: num1.divmod(num2) Parameters: The function needs two… Read More
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. … Read More