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

ruby-changes:8498

From: yugui <ko1@a...>
Date: Thu, 30 Oct 2008 01:10:55 +0900 (JST)
Subject: [ruby-changes:8498] Ruby:r20032 (ruby_1_9_1): merged r20005 and r20007 from trunk into ruby_1_9_1.

yugui	2008-10-30 01:09:14 +0900 (Thu, 30 Oct 2008)

  New Revision: 20032

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

  Log:
    merged r20005 and r20007 from trunk into ruby_1_9_1.
            * math.c (rb_math_{atan2,cos,cosh,hypot,log,sin,sinh,sqrt}): added.
            * complex.c: follows the above change.

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/complex.c
    branches/ruby_1_9_1/math.c

Index: ruby_1_9_1/complex.c
===================================================================
--- ruby_1_9_1/complex.c	(revision 20031)
+++ ruby_1_9_1/complex.c	(revision 20032)
@@ -426,31 +426,31 @@
     return rb_funcall2(rb_cComplex, id_convert, argc, argv);
 }
 
-extern VALUE math_atan2(VALUE obj, VALUE x, VALUE y);
-extern VALUE math_cos(VALUE obj, VALUE x);
-extern VALUE math_cosh(VALUE obj, VALUE x);
-extern VALUE math_exp(VALUE obj, VALUE x);
-extern VALUE math_hypot(VALUE obj, VALUE x, VALUE y);
-extern VALUE math_log(int argc, VALUE *argv);
-extern VALUE math_sin(VALUE obj, VALUE x);
-extern VALUE math_sinh(VALUE obj, VALUE x);
-extern VALUE math_sqrt(VALUE obj, VALUE x);
+extern VALUE rb_math_atan2(VALUE x, VALUE y);
+extern VALUE rb_math_cos(VALUE x);
+extern VALUE rb_math_cosh(VALUE x);
+extern VALUE rb_math_exp(VALUE x);
+extern VALUE rb_math_hypot(VALUE x, VALUE y);
+extern VALUE rb_math_log(int argc, VALUE *argv);
+extern VALUE rb_math_sin(VALUE x);
+extern VALUE rb_math_sinh(VALUE x);
+extern VALUE rb_math_sqrt(VALUE x);
 
-#define m_atan2_bang(x,y) math_atan2(Qnil,x,y)
-#define m_cos_bang(x) math_cos(Qnil,x)
-#define m_cosh_bang(x) math_cosh(Qnil,x)
-#define m_exp_bang(x) math_exp(Qnil,x)
-#define m_hypot(x,y) math_hypot(Qnil,x,y)
+#define m_atan2_bang(x,y) rb_math_atan2(x,y)
+#define m_cos_bang(x) rb_math_cos(x)
+#define m_cosh_bang(x) rb_math_cosh(x)
+#define m_exp_bang(x) rb_math_exp(x)
+#define m_hypot(x,y) rb_math_hypot(x,y)
 
 static VALUE
 m_log_bang(VALUE x)
 {
-    return math_log(1, &x);
+    return rb_math_log(1, &x);
 }
 
-#define m_sin_bang(x) math_sin(Qnil,x)
-#define m_sinh_bang(x) math_sinh(Qnil,x)
-#define m_sqrt_bang(x) math_sqrt(Qnil,x)
+#define m_sin_bang(x) rb_math_sin(x)
+#define m_sinh_bang(x) rb_math_sinh(x)
+#define m_sqrt_bang(x) rb_math_sqrt(x)
 
 static VALUE
 m_cos(VALUE x)
Index: ruby_1_9_1/math.c
===================================================================
--- ruby_1_9_1/math.c	(revision 20031)
+++ ruby_1_9_1/math.c	(revision 20032)
@@ -81,7 +81,7 @@
  *     
  */
 
-VALUE
+static VALUE
 math_atan2(VALUE obj, VALUE y, VALUE x)
 {
     Need_Float2(y, x);
@@ -97,7 +97,7 @@
  *  -1..1.
  */
 
-VALUE
+static VALUE
 math_cos(VALUE obj, VALUE x)
 {
     Need_Float(x);
@@ -112,7 +112,7 @@
  *  -1..1.
  */
 
-VALUE
+static VALUE
 math_sin(VALUE obj, VALUE x)
 {
     Need_Float(x);
@@ -203,7 +203,7 @@
  *  Computes the hyperbolic cosine of <i>x</i> (expressed in radians).
  */
 
-VALUE
+static VALUE
 math_cosh(VALUE obj, VALUE x)
 {
     Need_Float(x);
@@ -227,7 +227,7 @@
  *  radians).
  */
 
-VALUE
+static VALUE
 math_sinh(VALUE obj, VALUE x)
 {
     Need_Float(x);
@@ -317,7 +317,7 @@
  *  Returns e**x.
  */
 
-VALUE
+static VALUE
 math_exp(VALUE obj, VALUE x)
 {
     Need_Float(x);
@@ -343,7 +343,7 @@
  *  of logarithm.
  */
 
-VALUE
+static VALUE
 math_log(int argc, VALUE *argv)
 {
     VALUE x, base;
@@ -438,7 +438,7 @@
  *
  */
 
-VALUE
+static VALUE
 math_sqrt(VALUE obj, VALUE x)
 {
     double d;
@@ -540,7 +540,7 @@
  *     Math.hypot(3, 4)   #=> 5.0
  */
 
-VALUE
+static VALUE
 math_hypot(VALUE obj, VALUE x, VALUE y)
 {
     Need_Float2(x, y);
@@ -653,6 +653,38 @@
     return rb_assoc_new(v, INT2FIX(sign));
 }
 
+
+#define exp1(n) \
+VALUE \
+rb_math_##n(VALUE x)\
+{\
+    return math_##n(rb_mMath, x);\
+}
+
+#define exp2(n) \
+VALUE \
+rb_math_##n(VALUE x, VALUE y)\
+{\
+    return math_##n(rb_mMath, x, y);\
+}
+
+exp2(atan2)
+exp1(cos)
+exp1(cosh)
+exp1(exp)
+exp2(hypot)
+
+VALUE
+rb_math_log(int argc, VALUE *argv)
+{
+    return math_log(argc, argv);
+}
+
+exp1(sin)
+exp1(sinh)
+exp1(sqrt)
+
+
 /*
  *  The <code>Math</code> module contains module functions for basic
  *  trigonometric and transcendental functions. See class
Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 20031)
+++ ruby_1_9_1/ChangeLog	(revision 20032)
@@ -30,6 +30,12 @@
 	* win32/win32.c (rb_w32_open): need to seek to the end of the file when
 	  O_APPEND is specified.
 
+Wed Oct 29 00:08:05 2008  Tadayoshi Funaba  <tadf@d...>
+
+	* math.c (rb_math_{atan2,cos,cosh,hypot,log,sin,sinh,sqrt}): added.
+
+	* complex.c: follows the above change.
+
 Tue Oct 28 23:29:06 2008  NARUSE, Yui  <naruse@r...>
 
 	* ext/nkf/nkf-utf8/nkf.c (kanji_convert): output unicode chars.

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

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