**(p1)
public
Raises float to the power of other.
2.0**3
Show source
static VALUE
flo_pow(VALUE x, VALUE y)
{
if (RB_TYPE_P(y, T_FIXNUM)) {
return DBL2NUM(pow(RFLOAT_VALUE(x), (double)FIX2LONG(y)));
}
else if (RB_TYPE_P(y, T_BIGNUM)) {
return DBL2NUM(pow(RFLOAT_VALUE(x), rb_big2dbl(y)));
}
else if (RB_TYPE_P(y, 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));
}
}
else {
return rb_num_coerce_bin(x, y, rb_intern("**"));
}
}