ruby-changes:14891
From: naruse <ko1@a...>
Date: Thu, 25 Feb 2010 11:26:40 +0900 (JST)
Subject: [ruby-changes:14891] Ruby:r26760 (trunk): * rational.c (nurat_expt): use Float#** when Rational ** Float.
naruse 2010-02-25 11:26:22 +0900 (Thu, 25 Feb 2010) New Revision: 26760 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26760 Log: * rational.c (nurat_expt): use Float#** when Rational ** Float. This fixes Rational(3,1)**3.0=>26.99999999999999 on FreeBSD. * complex.c (rb_fexpt): removed. Note that this function is not static but is private. Modified files: trunk/ChangeLog trunk/complex.c trunk/rational.c Index: complex.c =================================================================== --- complex.c (revision 26759) +++ complex.c (revision 26760) @@ -825,14 +825,6 @@ f_mul(ere, m_sin_bang(im))); } -VALUE -rb_fexpt(VALUE x, VALUE y) -{ - if (f_zero_p(x) || (!k_float_p(x) && !k_float_p(y))) - return f_expt(x, y); - return m_exp(f_mul(m_log(x), y)); -} - inline static VALUE f_reciprocal(VALUE x) { Index: ChangeLog =================================================================== --- ChangeLog (revision 26759) +++ ChangeLog (revision 26760) @@ -1,3 +1,11 @@ +Thu Feb 25 11:17:01 2010 NARUSE, Yui <naruse@r...> + + * rational.c (nurat_expt): use Float#** when Rational ** Float. + This fixes Rational(3,1)**3.0=>26.99999999999999 on FreeBSD. + + * complex.c (rb_fexpt): removed. + Note that this function is not static but is private. + Thu Feb 25 00:43:57 2010 Koichi Sasada <ko1@a...> * insns.def: Change the operand type of setinlinecache Index: rational.c =================================================================== --- rational.c (revision 26759) +++ rational.c (revision 26760) @@ -901,8 +901,6 @@ return f_to_f(f_div(self, other)); } -extern VALUE rb_fexpt(VALUE x, VALUE y); - /* * call-seq: * rat ** numeric -> numeric_result @@ -959,7 +957,7 @@ /* fall through */ case T_FLOAT: case T_RATIONAL: - return rb_fexpt(f_to_f(self), other); + return f_expt(f_to_f(self), other); default: return rb_num_coerce_bin(self, other, id_expt); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/