Ruby Integer fdiv() function with example Last Updated : 24 Jun, 2020 Comments Improve Suggest changes Like Article Like Report The fdiv() function in Ruby returns the floating point result after division of two numbers. Syntax: (number1).fdiv(number2) Parameter: The function needs two numbers number1 and number2, where number1 is the dividend and number2 is the divisor. Return Value: The function returns the floating point division of two numbers. Example #1: Ruby # Ruby program of Integer fdiv() function # Initializing the numbers num1 = 5 num2 = 2 num3 = 9 num4 = 3 # Prints the division puts num1.fdiv(num2) puts num3.fdiv(num4) Output: 2.5 3.0 Example #2: Ruby # Ruby program of Integer fdiv() function # Initializing the numbers num1 = 15 num2 = 4 num3 = 10 num4 = 2 # Prints the integer division puts num1.fdiv(num2) puts num3.fdiv(num4) Output: 3.75 5.0 Comment More infoAdvertise with us Next Article Ruby Integer fdiv() function with example gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Integer-class Similar Reads Ruby Integer to_f function with example The to_f function in Ruby converts the value of the number as a float. If it does not fit in float, then it returns infinity. Syntax: number.to_f Parameter: The function takes the integer which is to be converted to float. Return Value: The function returns the float value of the number. Example #1: 1 min read Ruby Integer floor() function with example The ceil function in Ruby returns the smallest number smaller than or equal to int with a precision of ndigits decimal digits. The default is considered to be 0. When the precision given is negative, the returned value is an integer with at least ndigits.abs trailing zeros. It returns self when ndig 1 min read Ruby Integer div() function with example The div() function in Ruby returns the integer division of two numbers. Syntax: (number1).div(number2) Parameter: The function needs two numbers number1 and number2, where number1 is the dividend and number2 is the divisor. Return Value: The function returns the integer division of two numbers. Exam 1 min read Ruby Integer gcd() function with example The gcd() function in Ruby returns the gcd of two numbers. GCD signifies the greatest common divisor which divides both the numbers. Syntax: number1.gcd(number2) Parameter: The function requires two numbers whose gcd is to be returned. Return Value: The function returns the gcd of two numbers Exampl 1 min read Ruby Integer abs() function with example The abs() function in Ruby returns the absolute value of the integer. Syntax: (number).abs Parameter: The function takes the integer whose absolute value is to be returned. Return Value: The function returns the absolute value of the integer. Example #1: Ruby # Ruby program Integer abs() function # 1 min read Ruby Integer lcm() function with example The lcm() function in Ruby returns the lcm of two numbers. LCM signifies the lowest common multiple which is divisible by both the numbers. Syntax: number1.lcm(number2) Parameter: The function requires two numbers whose lcm is returned. Return Value: The function returns the lcm of two numbers Examp 1 min read Ruby Integer odd? function with example The odd? function in Ruby returns a boolean value. It returns true if the number is odd, else it returns false. Syntax: number.odd? Parameter: The function takes the integer which is to be checked for odd or not. Return Value: The function returns a boolean value which determines if the value is odd 1 min read Ruby Integer chr function with example The chr function in Ruby returns the string containing the character represented by the int's value according to encoding. Syntax: string.chr([encoding]) Parameter: The function takes the integer value whose encoding is to be done. It takes a non-mandatory parameter encoding if encoding is to be don 1 min read Ruby Integer to_r function with example The to_r function in Ruby converts the value of the number to a rational. Syntax: number.to_r Parameter: The function takes the number which is to be converted to a rational number. Return Value: The function returns the rational number. Example #1: Ruby # Ruby program for to_r function # Initializi 1 min read Ruby Integer size() function with example The size() function in Ruby returns the number of bytes in the machine representation of int. Syntax: number.size Parameter: The function takes the integer whose number of bytes is returned. Return Value: The function returns the number of bytes. Example #1: Ruby # Ruby program for size() function # 1 min read Like