Tag Archives: Ruby Rational-class

The to_s() is an inbuilt function in Ruby returns value as string Syntax: rat.to_s() Parameters: The function accepts no parameter Return Value: It returns value… Read More
The truncate() is an inbuilt function in Ruby returns rat truncated (toward zero) to a precision of ndigits decimal digits. ndigits by default is 0.… Read More
The abs() is an inbuilt function in Ruby returns the absolute value of rational. Syntax: rational.abs() Parameters: The function accepts no parameter Return Value: It… Read More
The == is an inbuilt method in Ruby returns boolean value true if two rational numbers are same otherwise false Syntax: rat1 == rat2 Parameters:… Read More
The <=> is an inbuilt method in Ruby returns -1, 0, or +1 depending on whether rational is less than, equal to, or greater than… Read More
The ** is an inbuilt method in Ruby returns the rational number by performing exponentiation between two rational numbers. Syntax: rat1 ** rat2 Parameters: The… Read More
The – is an inbuilt method in Ruby returns the rational number by performing subtraction between two rational numbers. Syntax: rat1 – rat2 Parameters: The… Read More
The + is an inbuilt method in Ruby returns the rational number by perfroming addition between two rational numbers. Syntax: rat1 + rat2 Parameters: The… Read More
The / is an inbuilt method in Ruby returns the rational number by performing division between two rational numbers. Syntax: rat1 / rat2 Parameters: The… Read More
The * is an inbuilt method in Ruby returns the rational number by perfroming multiplication between two rational numbers. Syntax: rat1 * rat2 Parameters: The… Read More