Ruby Float modulo() method with example Last Updated : 07 Jan, 2020 Comments Improve Suggest changes Like Article Like Report Float modulo() is a float class method which return the remainder value on dividing two float values. Syntax: float.modulo() Parameter: remainder value from the operation p/q Return: Modulo i.e. Remainder Example #1: Example for modulo() method Ruby # Ruby program for modulo() method # Initilizig value a = 26.00 b = 8.0 # Printing result puts "numerator : #{a}\n\n" puts "Division float/float : #{a.modulo(b)}\n\n" puts "Division float/float : #{b.modulo(a)}\n\n" Output : numerator : 26.0 Division float/float : 2.0 Division float/float : 8.0 Example #2: Ruby # Ruby code for modulo() method # Initializing value a = 7.00.numerator() # Printing result puts "numerator : #{a}\n\n" puts "Division float/int : #{a.modulo(4)}\n\n" puts "Division float/float : #{a.modulo(4.0)}\n\n" Output : numerator : 7 Division float/int : 3 Division float/float : 3.0 Comment More infoAdvertise with us Next Article Ruby Float modulo() method with example M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby Float-class Similar Reads Ruby Float quo() method with example Float quo() is a float class method which return the quotient value of the division. Syntax: float.quo() Parameter: float values - dividend and divisor Return: Quotient value of the division. Example #1: Ruby # Ruby code for quo() method # Initializing value a = 4.0 b = 2.0 # Printing result puts 1 min read Ruby Float fdiv() method with example Float fdiv() is a float class method which return a division value of the form p/q. Syntax: float.fdiv() Parameter: values to divide - p and q Return: Division value - Quotient Example #1: Ruby # Ruby program for fdiv() method # Initializing value a = 2.0.numerator() # returning machine dependent re 1 min read Ruby Float zero?() method with example Float#zero() : zero() is a float class method which checks whether the float value is zero. Syntax: float.zero() Parameter:float value which is to be checked Return: Boolean value return true if value is zero otherwise return false Example #1: Ruby # Ruby code for zero?() method # Initializing value 1 min read Ruby Float floor() method with example floor() is a float class method which return the floor value of the passed float value. Syntax: float.floor() Parameter: float value which is to get its floor value decimal digits (default = 0) Return: smallest number >= to float with a ndigits decimal point precision. For -ve precision : Integer 1 min read Ruby Float divmod() method with example Float divmod() is a float class method that returns an array having the quotient and remainder on dividing two numbers. Syntax: float.divmod()Parameter: float values - dividend and divisorReturn: An array with quotient and remainder. Example #1:Â Ruby # Ruby code for divmod() method # Initializing v 1 min read Like