**(p1)
public
Raises float the other power.
2.0**3
Show source
static VALUE
flo_pow(VALUE x, VALUE y)
{
switch (TYPE(y)) {
case T_FIXNUM:
return DBL2NUM(pow(RFLOAT_VALUE(x), (double)FIX2LONG(y)));
case T_BIGNUM:
return DBL2NUM(pow(RFLOAT_VALUE(x), rb_big2dbl(y)));
case T_FLOAT:
{
double dx = RFLOAT_VALUE(x);
double dy = RFLOAT_VALUE(y);
if (dx < 0 && dy != round(dy))
return rb_funcall(rb_complex_raw1(x), rb_intern("**"), 1, y);
return DBL2NUM(pow(dx, dy));
}
default:
return rb_num_coerce_bin(x, y, rb_intern("**"));
}
}