[前][次][番号順一覧][スレッド一覧]

ruby-changes:12409

From: wyhaines <ko1@a...>
Date: Wed, 15 Jul 2009 04:30:21 +0900 (JST)
Subject: [ruby-changes:12409] Ruby:r24109 (ruby_1_8_6): Adjust #angle/#arg NaN return as per issue #1715 and recent rubyspec changes. Adjust angle/arg handling of (-0.0).angle as per r23960 & recent rubyspec changes.

wyhaines	2009-07-15 04:28:58 +0900 (Wed, 15 Jul 2009)

  New Revision: 24109

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24109

  Log:
    Adjust #angle/#arg NaN return as per issue #1715 and recent rubyspec changes. Adjust angle/arg handling of (-0.0).angle as per r23960 & recent rubyspec changes.

  Modified files:
    branches/ruby_1_8_6/ChangeLog
    branches/ruby_1_8_6/lib/complex.rb
    branches/ruby_1_8_6/version.h

Index: ruby_1_8_6/ChangeLog
===================================================================
--- ruby_1_8_6/ChangeLog	(revision 24108)
+++ ruby_1_8_6/ChangeLog	(revision 24109)
@@ -1,3 +1,7 @@
+Tue Jul 14 13:14:00 2009 Kirk Haines <khaines@r...>
+
+	* lib/complex.rb: Adjust #angle/#arg NaN return as per issue #1715 and recent rubyspec changes. Adjust angle/arg handling of (-0.0).angle as per r23960 & recent rubyspec changes.
+
 Mon Jul 13 12:00:00 2009 Kirk Haines <khaines@r...>
 
 	* numeric.c, bignum.c: Applied changes from r23730. Infinity is > any bignum number in comparisons.
Index: ruby_1_8_6/version.h
===================================================================
--- ruby_1_8_6/version.h	(revision 24108)
+++ ruby_1_8_6/version.h	(revision 24109)
@@ -2,7 +2,7 @@
 #define RUBY_RELEASE_DATE "2009-06-08"
 #define RUBY_VERSION_CODE 186
 #define RUBY_RELEASE_CODE 20090608
-#define RUBY_PATCHLEVEL 379
+#define RUBY_PATCHLEVEL 380
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
Index: ruby_1_8_6/lib/complex.rb
===================================================================
--- ruby_1_8_6/lib/complex.rb	(revision 24108)
+++ ruby_1_8_6/lib/complex.rb	(revision 24109)
@@ -58,8 +58,10 @@
   # 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]