# Rb_big_pow

e\$B\$U\$He(B test_integer.rb e\$B\$N<B9T\$re(B callgrind
e\$B\$r\$+\$1\$F!"e(Bbignum.c
e\$B\$rD/\$a\$F\$\$\$k\$H!“e(Brb_big_pow e\$B\$NCf\$K<B9T\$5\$l\$J\$\$ItJ,\$,\$”\$k\$N\$Ke(B
e\$B5\$\$,\$D\$-\$^\$7\$?!#\$=\$7\$F\$7\$P\$i\$/D/\$a\$?7k2L!“e(Bn e\$B\$H\$\$\$&JQ?t\$O\$:\$Ce(B
e\$B\$He(B 1 e\$B\$J\$3\$H\$K5\$\$,\$D\$\$\$F\$7\$^\$\$\$^\$7\$?!#\$J\$K\$+JQ\$@\$H;W\$&\$s\$G\$9e(B
e\$B\$,!”\$I\$&\$J\$s\$G\$7\$g\$&e(B?

case T_FIXNUM:
yy = FIX2LONG(y);
if (yy > 0) {
VALUE z = 0;
SIGNED_VALUE mask, n = 1; // e\$B\$3\$3\$Ge(B 1 e\$B\$r@_Dje(B

if (!z) {
SIGNED_VALUE n2 = n * n; // 1 * 1 e\$B\$Oe(B 1
if (!POSFIXABLE(n2) || (n2 / n != n)) { //
e\$B>[email protected])\$7\$J\$\$e(B
z = bigtrunc(bigsqr(rb_int2big(n))); //
e\$B\$3\$3\$O<B9T\$5\$l\$J\$\$e(B
}
else {
n = n2; // e\$B\$3\$3\$Ge(B 1 e\$B\$rBeF~e(B
}
}
else {
z = bigtrunc(bigsqr(z));
}
if (!z) z = rb_int2big(n); //
rb_int2bige\$B\$K\$O>o\$Ke(B 1 e\$B\$rEO\$9e(B
z = bigtrunc(rb_big_mul0(z, x));
}
}
return bignorm(z);
}
d = (double)yy;
break;

e\$B\$J\$+\$@\$G\$9!#e(B

At Sun, 15 Jul 2007 23:37:08 +0900,
Tanaka A. wrote in [ruby-dev:31236]:

e\$B\$U\$He(B test_integer.rb e\$B\$N<B9T\$re(B callgrind e\$B\$r\$+\$1\$F!"e(Bbignum.c
e\$B\$rD/\$a\$F\$\$\$k\$H!“e(Brb_big_pow e\$B\$NCf\$K<B9T\$5\$l\$J\$\$ItJ,\$,\$”\$k\$N\$Ke(B
e\$B5\$\$,\$D\$-\$^\$7\$?!#\$=\$7\$F\$7\$P\$i\$/D/\$a\$?7k2L!“e(Bn e\$B\$H\$\$\$&JQ?t\$O\$:\$Ce(B
e\$B\$He(B 1 e\$B\$J\$3\$H\$K5\$\$,\$D\$\$\$F\$7\$^\$\$\$^\$7\$?!#\$J\$K\$+JQ\$@\$H;W\$&\$s\$G\$9e(B
e\$B\$,!”\$I\$&\$J\$s\$G\$7\$g\$&e(B?

e\$B\$?\$7\$+\$KITMW\$N\$h\$&\$G\$9!#e(B

``````                z = bigtrunc(bigsqr(z));
}