/* * call-seq: * flt == obj => true or false * * Returns <code>true</code> only if <i>obj</i> has the same value * as <i>flt</i>. Contrast this with <code>Float#eql?</code>, which * requires <i>obj</i> to be a <code>Float</code>. * * 1.0 == 1 #=> true * */ static VALUE flo_eq(x, y) VALUE x, y; { volatile double a, b; switch (TYPE(y)) { case T_FIXNUM: b = FIX2LONG(y); break; case T_BIGNUM: b = rb_big2dbl(y); break; case T_FLOAT: b = RFLOAT(y)->value; if (isnan(b)) return Qfalse; break; default: return num_equal(x, y); } a = RFLOAT(x)->value; if (isnan(a)) return Qfalse; return (a == b)?Qtrue:Qfalse; }