int rb_big_sign(VALUE obj) { NativeMethodEnvironment* env = NativeMethodEnvironment::get(); Bignum* big = c_as<Bignum>(env->get_object(obj)); return big->mp_val()->sign != MP_NEG; }
double rb_big2dbl(VALUE obj) { NativeMethodEnvironment* env = NativeMethodEnvironment::get(); Bignum* big = c_as<Bignum>(env->get_object(obj)); double d = big->to_double(env->state()); if(isinf(d)) { rb_warn("Bignum out of Float range"); if(big->mp_val()->sign == MP_NEG) { d = -HUGE_VAL; } else { d = HUGE_VAL; } } return d; }