==(p1)
public
Returns true only if obj has the same value as big.
Contrast this with Bignum#eql?, which requires obj to be a Bignum.
68719476736 == 68719476736.0
Show source
/*
* call-seq:
* big == obj => true or false
*
* Returns <code>true</code> only if <i>obj</i> has the same value
* as <i>big</i>. Contrast this with <code>Bignum
* requires <i>obj</i> to be a <code>Bignum</code>.
*
* 68719476736 == 68719476736.0
*/
static VALUE
rb_big_eq(x, y)
VALUE x, y;
{
switch (TYPE(y)) {
case T_FIXNUM:
y = rb_int2big(FIX2LONG(y));
break;
case T_BIGNUM:
break;
case T_FLOAT:
{
volatile double a, b;
a = RFLOAT(y)->value;
if (isnan(a)) return Qfalse;
b = rb_big2dbl(x);
return (a == b)?Qtrue:Qfalse;
}
default:
return rb_equal(y, x);
}
if (RBIGNUM(x)->sign != RBIGNUM(y)->sign) return Qfalse;
if (RBIGNUM(x)->len != RBIGNUM(y)->len) return Qfalse;
if (MEMCMP(BDIGITS(x),BDIGITS(y),BDIGIT,RBIGNUM(y)->len) != 0) return Qfalse;
return Qtrue;
}