ruby-changes:53306
From: nobu <ko1@a...>
Date: Sun, 4 Nov 2018 09:22:18 +0900 (JST)
Subject: [ruby-changes:53306] nobu:r65522 (trunk): complex.c: rb_dbl_complex_polar_pi
nobu 2018-11-04 09:22:13 +0900 (Sun, 04 Nov 2018) New Revision: 65522 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65522 Log: complex.c: rb_dbl_complex_polar_pi * complex.c (rb_dbl_complex_polar_pi): suffixed with _pi to clarify that `ang` is not radian, but multiplied by PI. Modified files: trunk/bignum.c trunk/complex.c trunk/internal.h trunk/numeric.c Index: complex.c =================================================================== --- complex.c (revision 65521) +++ complex.c (revision 65522) @@ -546,7 +546,7 @@ f_complex_polar(VALUE klass, VALUE x, VA https://github.com/ruby/ruby/blob/trunk/complex.c#L546 /* returns a Complex or Float of ang*PI-rotated abs */ VALUE -rb_dbl_complex_polar(double abs, double ang) +rb_dbl_complex_polar_pi(double abs, double ang) { double fi; const double fr = modf(ang, &fi); Index: numeric.c =================================================================== --- numeric.c (revision 65521) +++ numeric.c (revision 65522) @@ -1276,7 +1276,7 @@ rb_float_pow(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L1276 dx = RFLOAT_VALUE(x); dy = RFLOAT_VALUE(y); if (dx < 0 && dy != round(dy)) - return rb_dbl_complex_polar(pow(-dx, dy), dy); + return rb_dbl_complex_polar_pi(pow(-dx, dy), dy); } else { return rb_num_coerce_bin(x, y, idPow); @@ -4056,7 +4056,7 @@ fix_pow(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L4056 if (a == 1) return DBL2NUM(1.0); { if (a < 0 && dy != round(dy)) - return rb_dbl_complex_polar(pow(-(double)a, dy), dy); + return rb_dbl_complex_polar_pi(pow(-(double)a, dy), dy); return DBL2NUM(pow((double)a, dy)); } } Index: bignum.c =================================================================== --- bignum.c (revision 65521) +++ bignum.c (revision 65522) @@ -6211,7 +6211,7 @@ rb_big_pow(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L6211 if (RB_FLOAT_TYPE_P(y)) { d = RFLOAT_VALUE(y); if ((BIGNUM_NEGATIVE_P(x) && !BIGZEROP(x))) { - return rb_dbl_complex_polar(pow(-rb_big2dbl(x), d), d); + return rb_dbl_complex_polar_pi(pow(-rb_big2dbl(x), d), d); } } else if (RB_BIGNUM_TYPE_P(y)) { Index: internal.h =================================================================== --- internal.h (revision 65521) +++ internal.h (revision 65522) @@ -1299,7 +1299,7 @@ VALUE rb_complex_plus(VALUE, VALUE); https://github.com/ruby/ruby/blob/trunk/internal.h#L1299 VALUE rb_complex_mul(VALUE, VALUE); VALUE rb_complex_abs(VALUE x); VALUE rb_complex_sqrt(VALUE x); -VALUE rb_dbl_complex_polar(double abs, double ang); +VALUE rb_dbl_complex_polar_pi(double abs, double ang); VALUE rb_complex_pow(VALUE self, VALUE other); /* cont.c */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/