Ruby | Numeric dup() function Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report 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 dup() of num puts num Output: 1.7 Example 2: Ruby # Ruby program for dup() method in Numeric # Initialize a number num1 = 19 # Function used num = num1.dup() # Prints dup() of num puts num Output: 19 Comment More infoAdvertise with us Next Article Ruby | Numeric div() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Numeric-class Similar Reads Ruby | Numeric div() function The div() is an inbuilt method in Ruby that returns the result after performing an integer division. Syntax: num1.div(num2) Parameters: The function needs two numbers whose integer division is to be performed. Return Value: It returns returns the integer division.Example 1: CPP #Ruby program for div 1 min read Ruby | Numeric fdiv() function The fdiv() is an inbuilt method in Ruby returns the result after performing a float division. Syntax: num1.fdiv(num2) Parameters: The function needs two numbers whose float division is to be performed. Return Value: It returns returns the float division. Example 1: CPP # Ruby program for fdiv() meth 1 min read Ruby | Numeric eql?() function 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. Syntax: num1.eql?(num2) Parameters: The function needs two number whose comparison is to be done. Return Value: It returns returns true if both are equal, else it r 1 min read Ruby | Numeric divmod() function 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 numbers whose integer division is to be performed. Return Value: It returns returns the integer quotient and modulus after pe 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 conj() function 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 only. Example 1:  Ruby # Ruby program for conj() method in Numeric # Initialize a number num1 = 1.7 # Function used num = num1.conj() # P 1 min read Like