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:
a = - 100 . 7 - 10 . 4
b = - 100 * 2000 . 0
c = ( 22 + 7 . 1 ) * 4
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:
a = - 56 . 23333333
b = 10000 . 0
c = -( 22 + 7 . 1 )
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
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
07 Jan, 2020
Like Article
Save Article