coerce(p1)
public
Returns an array with both a numeric and a big
represented as Bignum objects.
This is achieved by converting numeric to a Bignum.
A TypeError is raised if the numeric
is not a Fixnum or Bignum type.
(0x3FFFFFFFFFFFFFFF+1).coerce(42)
Show source
static VALUE
rb_big_coerce(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
}
else if (!RB_BIGNUM_TYPE_P(y)) {
rb_raise(rb_eTypeError, "can't coerce %s to Bignum",
rb_obj_classname(y));
}
return rb_assoc_new(y, x);
}