mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* complex.c (f_complex_polar): simple bug reproduced only when y is
a float but x is not a float. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
46c64caff6
commit
b53d547f38
3 changed files with 7 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Fri May 22 20:56:33 2015 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* complex.c (f_complex_polar): simple bug reproduced only when y is
|
||||
a float but x is not a float.
|
||||
|
||||
Fri May 22 19:42:06 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* process.c (rb_spawn_process): do not discard global escape
|
||||
|
|
|
@ -592,8 +592,8 @@ f_complex_polar(VALUE klass, VALUE x, VALUE y)
|
|||
y = DBL2NUM(imag);
|
||||
}
|
||||
else {
|
||||
y = f_mul(x, DBL2NUM(sin(arg)));
|
||||
x = f_mul(x, DBL2NUM(cos(arg)));
|
||||
y = f_mul(y, DBL2NUM(sin(arg)));
|
||||
if (canonicalization && f_zero_p(y)) return x;
|
||||
}
|
||||
return nucomp_s_new_internal(klass, x, y);
|
||||
|
|
|
@ -212,6 +212,7 @@ class Complex_Test < Test::Unit::TestCase
|
|||
|
||||
def test_polar
|
||||
assert_equal([1,2], Complex.polar(1,2).polar)
|
||||
assert_equal(Complex.polar(1.0, Math::PI * 2 / 3), Complex.polar(1, Math::PI * 2 / 3))
|
||||
end
|
||||
|
||||
def test_uplus
|
||||
|
|
Loading…
Add table
Reference in a new issue