Ruby Float arg() method with example Last Updated : 07 Jan, 2020 Comments Improve Suggest changes Like Article Like Report Float arg() is a float class method which works on float values and works differently for both positive and negative values. Syntax: float.arg() Parameter: float value which is to be checked Return: return 0 for positive values. Otherwise pi(3.141592653589793) Example #1: Ruby # Ruby code for arg() method # Initializing values a = -100.7 - 10.4 b = -100 * 2000.0 c = (22 + 7.1) * 4 # Printing result puts "arg value of a : #{a.arg}\n\n" puts "arg value of b : #{b.arg}\n\n" puts "arg value of c : #{c.arg}\n\n" Output : arg value of a : 3.141592653589793 arg value of b : 3.141592653589793 arg value of c : 0 Example #2: Ruby # Ruby code for arg() method # Initializing value a = -56.23333333 b = 10000.0 c = -(22 + 7.1) # Printing result puts "arg value of a : #{a.arg}\n\n" puts "arg value of b : #{b.arg}\n\n" puts "arg value of c : #{c.arg}\n\n" Output : arg value of a : 3.141592653589793 arg value of b : 0 arg value of c : 3.141592653589793 Comment More infoAdvertise with us Next Article Ruby Float arg() method with example M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby Float-class Similar Reads 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 rationalize() method with example Float rationalize() is a float class method which return the simple rational form (p/q) of a float value. Syntax: float.rationalize() Parameter: float value as argument Return: Simple approximation value Example #1: Ruby # Ruby program for rationalize() method # Initialize value a = 0.767 b = 2999.0 1 min read Ruby | Complex arg() method Complex#arg() is a Complex class method which returns the angle part of the polar form of complex value. Syntax: Complex.arg() Parameter: Complex values Return: angle part of the polar form of complex value. Example #1 : Ruby # Ruby code for Complex.arg() method # declaring Complex value a = Complex 1 min read Ruby Integer modulo() function with example The modulo function in Ruby returns the modulo value of a number by another number. Syntax: number1.modulo(number2) Parameter: The function takes number1 and number2 whose modulo is returned. Return Value: The function returns the modulo value of a number by another number. Example #1: Ruby # Rub 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 Like