/*
* call-seq:
* fix ** other => Numeric
*
* Raises <code>fix</code> to the <code>other</code> power, which may
* be negative or fractional.
*
* 2 ** 3 #=> 8
* 2 ** -1 #=> 0.5
* 2 ** 0.5 #=> 1.4142135623731
*/
static VALUE
fix_pow(x, y)
VALUE x, y;
{
if (FIXNUM_P(y)) {
long a, b;
b = FIX2LONG(y);
if (b == 0) return INT2FIX(1);
if (b == 1) return x;
a = FIX2LONG(x);
if (b > 0) {
return rb_big_pow(rb_int2big(a), y);
}
return rb_float_new(pow((double)a, (double)b));
} else if (TYPE(y) == T_FLOAT) {
long a = FIX2LONG(x);
return rb_float_new(pow((double)a, RFLOAT(y)->value));
}
return rb_num_coerce_bin(x, y);
}