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

ruby-changes:40390

From: naruse <ko1@a...>
Date: Sat, 7 Nov 2015 01:19:27 +0900 (JST)
Subject: [ruby-changes:40390] naruse:r52471 (trunk): Revert r52469

naruse	2015-11-07 01:19:08 +0900 (Sat, 07 Nov 2015)

  New Revision: 52471

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

  Log:
    Revert r52469
    
    "* lib/cmath.rb: methods which has suffix '!' are now deprecated."
    It breaks rubyspec:
    http://rubyci.s3.amazonaws.com/ubuntu1510/ruby-trunk/log/20151106T153002Z.fail.html.gz

  Modified files:
    trunk/ChangeLog
    trunk/NEWS
    trunk/lib/cmath.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52470)
+++ ChangeLog	(revision 52471)
@@ -1,8 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Sat Nov  7 00:03:50 2015  Kazuki Tanaka  <gogotanaka@r...>
-
-	* lib/cmath.rb: methods which has suffix '!' are now deprecated.
-	  [ruby-core:68528] [Feature #10974]
-
 Fri Nov  6 23:13:53 2015  Kazuki Tanaka  <gogotanaka@r...>
 
 	* array.c: clarifies Array#reject! documentation.
Index: lib/cmath.rb
===================================================================
--- lib/cmath.rb	(revision 52470)
+++ lib/cmath.rb	(revision 52471)
@@ -23,32 +23,29 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L23
 
   include Math
 
-  %w[
-    exp
-    log
-    log2
-    log10
-    sqrt
-    cbrt
-    sin
-    cos
-    tan
-    sinh
-    cosh
-    tanh
-    asin
-    acos
-    atan
-    atan2
-    asinh
-    acosh
-    atanh
-  ].each do |meth|
-    define_method(meth + '!') do |*args, &block|
-      warn("CMath##{meth}! is deprecated; use CMath##{meth} or Math##{meth}") if $VERBOSE
-      Math.send(meth, *args, &block)
-    end
-  end
+  alias exp! exp
+  alias log! log
+  alias log2! log2
+  alias log10! log10
+  alias sqrt! sqrt
+  alias cbrt! cbrt
+
+  alias sin! sin
+  alias cos! cos
+  alias tan! tan
+
+  alias sinh! sinh
+  alias cosh! cosh
+  alias tanh! tanh
+
+  alias asin! asin
+  alias acos! acos
+  alias atan! atan
+  alias atan2! atan2
+
+  alias asinh! asinh
+  alias acosh! acosh
+  alias atanh! atanh
 
   ##
   # Math::E raised to the +z+ power
@@ -57,11 +54,11 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L54
   def exp(z)
     begin
       if z.real?
-        Math.exp(z)
+        exp!(z)
       else
-        ere = Math.exp(z.real)
-        Complex(ere * Math.cos(z.imag),
-                ere * Math.sin(z.imag))
+        ere = exp!(z.real)
+        Complex(ere * cos!(z.imag),
+                ere * sin!(z.imag))
       end
     rescue NoMethodError
       handle_no_method_error
@@ -77,9 +74,9 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L74
   def log(z, b=::Math::E)
     begin
       if z.real? && z >= 0 && b >= 0
-        Math.log(z, b)
+        log!(z, b)
       else
-        Complex(Math.log(z.abs), z.arg) / log(b)
+        Complex(log!(z.abs), z.arg) / log(b)
       end
     rescue NoMethodError
       handle_no_method_error
@@ -93,9 +90,9 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L90
   def log2(z)
     begin
       if z.real? and z >= 0
-        Math.log2(z)
+        log2!(z)
       else
-        log(z) / Math.log(2)
+        log(z) / log!(2)
       end
     rescue NoMethodError
       handle_no_method_error
@@ -109,9 +106,9 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L106
   def log10(z)
     begin
       if z.real? and z >= 0
-        Math.log10(z)
+        log10!(z)
       else
-        log(z) / Math.log(10)
+        log(z) / log!(10)
       end
     rescue NoMethodError
       handle_no_method_error
@@ -126,9 +123,9 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L123
     begin
       if z.real?
         if z < 0
-          Complex(0, Math.sqrt(-z))
+          Complex(0, sqrt!(-z))
         else
-          Math.sqrt(z)
+          sqrt!(z)
         end
       else
         if z.imag < 0 ||
@@ -137,7 +134,7 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L134
         else
           r = z.abs
           x = z.real
-          Complex(Math.sqrt((r + x) / 2.0), Math.sqrt((r - x) / 2.0))
+          Complex(sqrt!((r + x) / 2.0), sqrt!((r - x) / 2.0))
         end
       end
     rescue NoMethodError
@@ -160,10 +157,10 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L157
   def sin(z)
     begin
       if z.real?
-        Math.sin(z)
+        sin!(z)
       else
-        Complex(Math.sin(z.real) * Math.cosh(z.imag),
-                Math.cos(z.real) * Math.sinh(z.imag))
+        Complex(sin!(z.real) * cosh!(z.imag),
+                cos!(z.real) * sinh!(z.imag))
       end
     rescue NoMethodError
       handle_no_method_error
@@ -177,10 +174,10 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L174
   def cos(z)
     begin
       if z.real?
-        Math.cos(z)
+        cos!(z)
       else
-        Complex(Math.cos(z.real) * Math.cosh(z.imag),
-                -Math.sin(z.real) * Math.sinh(z.imag))
+        Complex(cos!(z.real) * cosh!(z.imag),
+                -sin!(z.real) * sinh!(z.imag))
       end
     rescue NoMethodError
       handle_no_method_error
@@ -194,7 +191,7 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L191
   def tan(z)
     begin
       if z.real?
-        Math.tan(z)
+        tan!(z)
       else
         sin(z) / cos(z)
       end
@@ -210,10 +207,10 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L207
   def sinh(z)
     begin
       if z.real?
-        Math.sinh(z)
+        sinh!(z)
       else
-        Complex(Math.sinh(z.real) * Math.cos(z.imag),
-                Math.cosh(z.real) * Math.sin(z.imag))
+        Complex(sinh!(z.real) * cos!(z.imag),
+                cosh!(z.real) * sin!(z.imag))
       end
     rescue NoMethodError
       handle_no_method_error
@@ -227,10 +224,10 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L224
   def cosh(z)
     begin
       if z.real?
-        Math.cosh(z)
+        cosh!(z)
       else
-        Complex(Math.cosh(z.real) * Math.cos(z.imag),
-                Math.sinh(z.real) * Math.sin(z.imag))
+        Complex(cosh!(z.real) * cos!(z.imag),
+                sinh!(z.real) * sin!(z.imag))
       end
     rescue NoMethodError
       handle_no_method_error
@@ -244,7 +241,7 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L241
   def tanh(z)
     begin
       if z.real?
-        Math.tanh(z)
+        tanh!(z)
       else
         sinh(z) / cosh(z)
       end
@@ -260,7 +257,7 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L257
   def asin(z)
     begin
       if z.real? and z >= -1 and z <= 1
-        Math.asin(z)
+        asin!(z)
       else
         (-1.0).i * log(1.0.i * z + sqrt(1.0 - z * z))
       end
@@ -276,7 +273,7 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L273
   def acos(z)
     begin
       if z.real? and z >= -1 and z <= 1
-        Math.acos(z)
+        acos!(z)
       else
         (-1.0).i * log(z + 1.0.i * sqrt(1.0 - z * z))
       end
@@ -292,7 +289,7 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L289
   def atan(z)
     begin
       if z.real?
-        Math.atan(z)
+        atan!(z)
       else
         1.0.i * log((1.0.i + z) / (1.0.i - z)) / 2.0
       end
@@ -309,7 +306,7 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L306
   def atan2(y,x)
     begin
       if y.real? and x.real?
-        Math.atan2(y,x)
+        atan2!(y,x)
       else
         (-1.0).i * log((x + 1.0.i * y) / sqrt(x * x + y * y))
       end
@@ -325,7 +322,7 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L322
   def asinh(z)
     begin
       if z.real?
-        Math.asinh(z)
+        asinh!(z)
       else
         log(z + sqrt(1.0 + z * z))
       end
@@ -341,7 +338,7 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L338
   def acosh(z)
     begin
       if z.real? and z >= 1
-        Math.acosh(z)
+        acosh!(z)
       else
         log(z + sqrt(z * z - 1.0))
       end
@@ -357,7 +354,7 @@ module CMath https://github.com/ruby/ruby/blob/trunk/lib/cmath.rb#L354
   def atanh(z)
     begin
       if z.real? and z >= -1 and z <= 1
-        Math.atanh(z)
+        atanh!(z)
       else
         log((1.0 + z) / (1.0 - z)) / 2.0
       end
Index: NEWS
===================================================================
--- NEWS	(revision 52470)
+++ NEWS	(revision 52471)
@@ -181,9 +181,6 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L181
 * lib/matrix.rb
  * Add Vector#round. https://github.com/ruby/ruby/pull/802
 
-* lib/cmath.rb
- * methods which has suffix '!' are now deprecated.
-
 * ext/coverage/coverage.c
   * Coverage.peek_result: new method to allow coverage to be captured without
     stopping the coverage tool.

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

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