summaryrefslogtreecommitdiff
path: root/lib/complex.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/complex.rb')
-rw-r--r--lib/complex.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/complex.rb b/lib/complex.rb
index 9300f391e8..5b8ac25ff8 100644
--- a/lib/complex.rb
+++ b/lib/complex.rb
@@ -58,8 +58,10 @@ class Numeric
# See Complex#arg.
#
def arg
- if self >= 0
+ if self > 0 || (self == 0 && self.to_s != '-0.0') # This string comparison stuff is gross. Better way?
return 0
+ elsif self.to_f.nan?
+ return self
else
return Math::PI
end