Ruby | Numeric fdiv() function Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report 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() method in Numeric # Initialize a number num1 = 15 # Prints division of num1/4 puts num1.fdiv(4) Output: 3.75 Example 2: CPP # Ruby program for fdiv() method in Numeric # Initialize a number num1 = 20 # Prints division of num1/2 puts num1.fdiv(2) Output: 10.0 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 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 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 Ruby | Numeric finite?() function The finite?() is an inbuilt method in Ruby returns a boolean value. It returns true if the number is a finite one, else it returns false. Syntax: num.finite?() Parameters: The function needs a number which is to be checked for. Return Value: It returns returns a boolean value. Example 1: CPP # Ruby 1 min read Ruby | Numeric floor() function The floor() is an inbuilt method in Ruby returns a number less than or equal 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.floor(ndigits) Parameters: The functi 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 Like