[macruby-changes] [4087] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed May 12 20:17:52 PDT 2010


Revision: 4087
          http://trac.macosforge.org/projects/ruby/changeset/4087
Author:   martinlagardette at apple.com
Date:     2010-05-12 20:17:50 -0700 (Wed, 12 May 2010)
Log Message:
-----------
Improve core/float pass rate

 - Implement `#rationalize` on `nil`, `Rational`, `Float` and `Integer`
 - Fixed `#<=>`
 - Define `Float::INFINITY` and `Float::NAN` constants
 - Updated `divmod_spec.rb` and fixed `fdiv_spec.rb` to use `#be_close` instead of `#==`

Modified Paths:
--------------
    MacRuby/trunk/bignum.c
    MacRuby/trunk/numeric.c
    MacRuby/trunk/rational.c
    MacRuby/trunk/spec/frozen/core/float/divmod_spec.rb
    MacRuby/trunk/spec/frozen/core/float/fdiv_spec.rb
    MacRuby/trunk/spec/frozen/tags/macruby/core/float/fdiv_tags.txt
    MacRuby/trunk/spec/frozen/tags/macruby/core/float/rationalize_tags.txt

Removed Paths:
-------------
    MacRuby/trunk/spec/frozen/tags/macruby/core/float/comparison_tags.txt
    MacRuby/trunk/spec/frozen/tags/macruby/core/float/constants_tags.txt
    MacRuby/trunk/spec/frozen/tags/macruby/core/float/denominator_tags.txt
    MacRuby/trunk/spec/frozen/tags/macruby/core/float/divmod_tags.txt
    MacRuby/trunk/spec/frozen/tags/macruby/core/float/modulo_tags.txt
    MacRuby/trunk/spec/frozen/tags/macruby/core/float/numerator_tags.txt

Modified: MacRuby/trunk/bignum.c
===================================================================
--- MacRuby/trunk/bignum.c	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/bignum.c	2010-05-13 03:17:50 UTC (rev 4087)
@@ -1281,6 +1281,7 @@
 rb_big_cmp(VALUE x, VALUE y)
 {
     long xlen = RBIGNUM_LEN(x);
+    BDIGIT *xds, *yds;
 
     switch (TYPE(y)) {
       case T_FIXNUM:
@@ -1291,8 +1292,16 @@
 	break;
 
       case T_FLOAT:
-	return rb_dbl_cmp(rb_big2dbl(x), RFLOAT_VALUE(y));
+	{
+	    double a = RFLOAT_VALUE(y);
 
+	    if (isinf(a)) {
+		if (a > 0.0) return INT2FIX(-1);
+		else return INT2FIX(1);
+	    }
+	    return rb_dbl_cmp(rb_big2dbl(x), a);
+	}
+
       default:
 	return rb_num_coerce_cmp(x, y, rb_intern("<=>"));
     }
@@ -1304,9 +1313,12 @@
     if (xlen > RBIGNUM_LEN(y))
 	return (RBIGNUM_SIGN(x)) ? INT2FIX(1) : INT2FIX(-1);
 
-    while(xlen-- && (BDIGITS(x)[xlen]==BDIGITS(y)[xlen]));
+    xds = BDIGITS(x);
+    yds = BDIGITS(y);
+
+    while(xlen-- && (xds[xlen]==yds[xlen]));
     if (-1 == xlen) return INT2FIX(0);
-    return (BDIGITS(x)[xlen] > BDIGITS(y)[xlen]) ?
+    return (xds[xlen] > yds[xlen]) ?
 	(RBIGNUM_SIGN(x) ? INT2FIX(1) : INT2FIX(-1)) :
 	    (RBIGNUM_SIGN(x) ? INT2FIX(-1) : INT2FIX(1));
 }

Modified: MacRuby/trunk/numeric.c
===================================================================
--- MacRuby/trunk/numeric.c	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/numeric.c	2010-05-13 03:17:50 UTC (rev 4087)
@@ -65,6 +65,20 @@
 #define DBL_EPSILON 2.2204460492503131e-16
 #endif
 
+#ifdef HAVE_INFINITY
+#elif BYTE_ORDER == LITTLE_ENDIAN
+const unsigned char rb_infinity[] = "\x00\x00\x80\x7f";
+#else
+const unsigned char rb_infinity[] = "\x7f\x80\x00\x00";
+#endif
+
+#ifdef HAVE_NAN
+#elif BYTE_ORDER == LITTLE_ENDIAN
+const unsigned char rb_nan[] = "\x00\x00\xc0\x7f";
+#else
+const unsigned char rb_nan[] = "\x7f\xc0\x00\x00";
+#endif
+
 #ifndef HAVE_ROUND
 double
 round(double x)
@@ -732,7 +746,7 @@
 {
     double div, mod;
 
-    if (y == 0) {
+    if (y == 0.0) {
 	rb_num_zerodiv();
     }
 #ifdef HAVE_FMOD
@@ -798,13 +812,7 @@
 	d = round(d);
 	return LONG2FIX((long)d);
     }
-    else if (isnan(d) || isinf(d)) {
-	/* special case: cannot return integer value */
-	return rb_float_new(d);
-    }
-    else {
-	return rb_dbl2big(d);
-    }
+    return rb_dbl2big(d);
 }
 
 /*
@@ -983,12 +991,23 @@
     double a, b;
 
     a = RFLOAT_VALUE(x);
+    if (isnan(a)) {
+	return Qnil;
+    }
     switch (TYPE(y)) {
       case T_FIXNUM:
 	b = (double)FIX2LONG(y);
 	break;
 
       case T_BIGNUM:
+	if (isinf(a)) {
+	    if (a > 0.0) {
+		return INT2FIX(1);
+	    }
+	    else {
+		return INT2FIX(-1);
+	    }
+	}
 	b = rb_big2dbl(y);
 	break;
 
@@ -997,6 +1016,13 @@
 	break;
 
       default:
+	if (isinf(a) && (!rb_respond_to(y, rb_intern("infinite?")) ||
+			 !RTEST(rb_funcall(y, rb_intern("infinite?"), 0, 0)))) {
+	    if (a > 0.0) {
+		return INT2FIX(1);
+	    }
+	    return INT2FIX(-1);
+	}
 	return rb_num_coerce_cmp(x, y, rb_intern("<=>"));
     }
     return rb_dbl_cmp(a, b);
@@ -3475,6 +3501,8 @@
     rb_define_const(rb_cFloat, "MIN", DOUBLE2NUM(DBL_MIN));
     rb_define_const(rb_cFloat, "MAX", DOUBLE2NUM(DBL_MAX));
     rb_define_const(rb_cFloat, "EPSILON", DOUBLE2NUM(DBL_EPSILON));
+    rb_define_const(rb_cFloat, "INFINITY", DBL2NUM(INFINITY));
+    rb_define_const(rb_cFloat, "NAN", DBL2NUM(NAN));
 
     rb_objc_define_method(rb_cFloat, "to_s", flo_to_s, 0);
     rb_objc_define_method(rb_cFloat, "coerce", flo_coerce, 1);

Modified: MacRuby/trunk/rational.c
===================================================================
--- MacRuby/trunk/rational.c	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/rational.c	2010-05-13 03:17:50 UTC (rev 4087)
@@ -1356,6 +1356,141 @@
     return self;
 }
 
+#define id_ceil rb_intern("ceil")
+#define f_ceil(x) rb_funcall(x, id_ceil, 0)
+
+#define id_quo rb_intern("quo")
+#define f_quo(x,y) rb_funcall(x, id_quo, 1, y)
+
+#define f_reciprocal(x) f_quo(ONE, x)
+
+/*
+  The algorithm here is the method described in CLISP.  Bruno Haible has
+  graciously given permission to use this algorithm.  He says, "You can use
+  it, if you present the following explanation of the algorithm."
+
+  Algorithm (recursively presented):
+    If x is a rational number, return x.
+    If x = 0.0, return 0.
+    If x < 0.0, return (- (rationalize (- x))).
+    If x > 0.0:
+      Call (integer-decode-float x). It returns a m,e,s=1 (mantissa,
+      exponent, sign).
+      If m = 0 or e >= 0: return x = m*2^e.
+      Search a rational number between a = (m-1/2)*2^e and b = (m+1/2)*2^e
+      with smallest possible numerator and denominator.
+      Note 1: If m is a power of 2, we ought to take a = (m-1/4)*2^e.
+        But in this case the result will be x itself anyway, regardless of
+        the choice of a. Therefore we can simply ignore this case.
+      Note 2: At first, we need to consider the closed interval [a,b].
+        but since a and b have the denominator 2^(|e|+1) whereas x itself
+        has a denominator <= 2^|e|, we can restrict the search to the open
+        interval (a,b).
+      So, for given a and b (0 < a < b) we are searching a rational number
+      y with a <= y <= b.
+      Recursive algorithm fraction_between(a,b):
+        c := (ceiling a)
+        if c < b
+          then return c       ; because a <= c < b, c integer
+          else
+            ; a is not integer (otherwise we would have had c = a < b)
+            k := c-1          ; k = floor(a), k < a < b <= k+1
+            return y = k + 1/fraction_between(1/(b-k), 1/(a-k))
+                              ; note 1 <= 1/(b-k) < 1/(a-k)
+
+  You can see that we are actually computing a continued fraction expansion.
+
+  Algorithm (iterative):
+    If x is rational, return x.
+    Call (integer-decode-float x). It returns a m,e,s (mantissa,
+      exponent, sign).
+    If m = 0 or e >= 0, return m*2^e*s. (This includes the case x = 0.0.)
+    Create rational numbers a := (2*m-1)*2^(e-1) and b := (2*m+1)*2^(e-1)
+    (positive and already in lowest terms because the denominator is a
+    power of two and the numerator is odd).
+    Start a continued fraction expansion
+      p[-1] := 0, p[0] := 1, q[-1] := 1, q[0] := 0, i := 0.
+    Loop
+      c := (ceiling a)
+      if c >= b
+        then k := c-1, partial_quotient(k), (a,b) := (1/(b-k),1/(a-k)),
+             goto Loop
+    finally partial_quotient(c).
+    Here partial_quotient(c) denotes the iteration
+      i := i+1, p[i] := c*p[i-1]+p[i-2], q[i] := c*q[i-1]+q[i-2].
+    At the end, return s * (p[i]/q[i]).
+    This rational number is already in lowest terms because
+    p[i]*q[i-1]-p[i-1]*q[i] = (-1)^i.
+*/
+
+static void
+nurat_rationalize_internal(VALUE a, VALUE b, VALUE *p, VALUE *q)
+{
+    VALUE c, k, t, p0, p1, p2, q0, q1, q2;
+
+    p0 = ZERO;
+    p1 = ONE;
+    q0 = ONE;
+    q1 = ZERO;
+
+    while (1) {
+	c = f_ceil(a);
+	if (f_lt_p(c, b))
+	    break;
+	k = f_sub(c, ONE);
+	p2 = f_add(f_mul(k, p1), p0);
+	q2 = f_add(f_mul(k, q1), q0);
+	t = f_reciprocal(f_sub(b, k));
+	b = f_reciprocal(f_sub(a, k));
+	a = t;
+	p0 = p1;
+	q0 = q1;
+	p1 = p2;
+	q1 = q2;
+    }
+    *p = f_add(f_mul(c, p1), p0);
+    *q = f_add(f_mul(c, q1), q0);
+}
+
+/*
+ * call-seq:
+ *    rat.rationalize       ->  self
+ *    rat.rationalize(eps)  ->  rational
+ *
+ * Returns a simpler approximation of the value if an optional
+ * argument eps is given (rat-|eps| <= result <= rat+|eps|), self
+ * otherwise.
+ *
+ * For example:
+ *
+ *    r = Rational(5033165, 16777216)
+ *    r.rationalize                    #=> (5033165/16777216)
+ *    r.rationalize(Rational('0.01'))  #=> (3/10)
+ *    r.rationalize(Rational('0.1'))   #=> (1/3)
+ */
+static VALUE
+nurat_rationalize(VALUE self, SEL sel, int argc, VALUE *argv)
+{
+    VALUE e, a, b, p, q;
+
+    if (argc == 0)
+	return self;
+
+    if (f_negative_p(self))
+	return f_negate(nurat_rationalize(f_abs(self), sel, argc, argv));
+
+    rb_scan_args(argc, argv, "01", &e);
+    e = f_abs(e);
+    a = f_sub(self, e);
+    b = f_add(self, e);
+
+    if (f_eqeq_p(a, b))
+	return self;
+
+    nurat_rationalize_internal(a, b, &p, &q);
+    return f_rational_new2(CLASS_OF(self), p, q);
+}
+
 /* :nodoc: */
 static VALUE
 nurat_hash(VALUE self, SEL sel)
@@ -1620,7 +1755,8 @@
     double d = RFLOAT_VALUE(self);
     if (isinf(d) || isnan(d))
 	return self;
-    return ZERO;
+    return rb_vm_call(self, sel, 0, 0, true);
+//    return ZERO;
 //    return rb_call_super(0, 0);
 }
 
@@ -1639,7 +1775,8 @@
     double d = RFLOAT_VALUE(self);
     if (isinf(d) || isnan(d))
 	return INT2FIX(1);
-    return ZERO;
+    return rb_vm_call(self, sel, 0, 0, true);
+//    return ZERO;
 //    return rb_call_super(0, 0);
 }
 
@@ -1657,6 +1794,20 @@
 
 /*
  * call-seq:
+ *    nil.rationalize([eps])  ->  (0/1)
+ *
+ * Returns zero as a rational.  An optional argument eps is always
+ * ignored.
+ */
+static VALUE
+nilclass_rationalize(VALUE self, SEL sel, int argc, VALUE *argv)
+{
+    rb_scan_args(argc, argv, "01", NULL);
+    return nilclass_to_r(self, sel);
+}
+
+/*
+ * call-seq:
  *    int.to_r  ->  rational
  *
  * Returns the value as a rational.
@@ -1672,6 +1823,20 @@
     return rb_rational_new1(self);
 }
 
+/*
+ * call-seq:
+ *    int.rationalize([eps])  ->  rational
+ *
+ * Returns the value as a rational.  An optional argument eps is
+ * always ignored.
+ */
+static VALUE
+integer_rationalize(VALUE self, SEL sel, int argc, VALUE *argv)
+{
+    rb_scan_args(argc, argv, "01", NULL);
+    return integer_to_r(self, sel);
+}
+
 static void
 float_decode_internal(VALUE self, VALUE *rf, VALUE *rn)
 {
@@ -1737,6 +1902,64 @@
 #endif
 }
 
+/*
+ * call-seq:
+ *    flt.rationalize([eps])  ->  rational
+ *
+ * Returns a simpler approximation of the value (flt-|eps| <= result
+ * <= flt+|eps|).  if eps is not given, it will be chosen
+ * automatically.
+ *
+ * For example:
+ *
+ *    0.3.rationalize          #=> (3/10)
+ *    1.333.rationalize        #=> (1333/1000)
+ *    1.333.rationalize(0.01)  #=> (4/3)
+ */
+static VALUE
+float_rationalize(VALUE self, SEL sel, int argc, VALUE *argv)
+{
+    VALUE e, a, b, p, q;
+
+    if (f_negative_p(self))
+	return f_negate(float_rationalize(f_abs(self), sel, argc, argv));
+
+    rb_scan_args(argc, argv, "01", &e);
+
+    if (argc != 0) {
+	e = f_abs(e);
+	a = f_sub(self, e);
+	b = f_add(self, e);
+    }
+    else {
+	VALUE f, n;
+
+	float_decode_internal(self, &f, &n);
+	if (f_zero_p(f) || f_positive_p(n))
+	    return rb_rational_new1(f_lshift(f, n));
+
+#if FLT_RADIX == 2
+	a = rb_rational_new2(f_sub(f_mul(TWO, f), ONE),
+			     f_lshift(ONE, f_sub(ONE, n)));
+	b = rb_rational_new2(f_add(f_mul(TWO, f), ONE),
+			     f_lshift(ONE, f_sub(ONE, n)));
+#else
+	a = rb_rational_new2(f_sub(f_mul(INT2FIX(FLT_RADIX), f),
+				   INT2FIX(FLT_RADIX - 1)),
+			     f_expt(INT2FIX(FLT_RADIX), f_sub(ONE, n)));
+	b = rb_rational_new2(f_add(f_mul(INT2FIX(FLT_RADIX), f),
+				   INT2FIX(FLT_RADIX - 1)),
+			     f_expt(INT2FIX(FLT_RADIX), f_sub(ONE, n)));
+#endif
+    }
+
+    if (f_eqeq_p(a, b))
+	return f_to_r(self);
+
+    nurat_rationalize_internal(a, b, &p, &q);
+    return rb_rational_new2(p, q);
+}
+
 static VALUE rat_pat, an_e_pat, a_dot_pat, underscores_pat, an_underscore;
 
 #define WS "\\s*"
@@ -2110,6 +2333,7 @@
     rb_objc_define_method(rb_cRational, "to_i", nurat_truncate, 0);
     rb_objc_define_method(rb_cRational, "to_f", nurat_to_f, 0);
     rb_objc_define_method(rb_cRational, "to_r", nurat_to_r, 0);
+    rb_objc_define_method(rb_cRational, "rationalize", nurat_rationalize, 0);
 
     rb_objc_define_method(rb_cRational, "hash", nurat_hash, 0);
 
@@ -2135,8 +2359,11 @@
     rb_objc_define_method(rb_cFloat, "denominator", float_denominator, 0);
 
     rb_objc_define_method(rb_cNilClass, "to_r", nilclass_to_r, 0);
+    rb_objc_define_method(rb_cNilClass, "rationalize", nilclass_rationalize, -1);
     rb_objc_define_method(rb_cInteger, "to_r", integer_to_r, 0);
+    rb_objc_define_method(rb_cInteger, "rationalize", integer_rationalize, -1);
     rb_objc_define_method(rb_cFloat, "to_r", float_to_r, 0);
+    rb_objc_define_method(rb_cFloat, "rationalize", float_rationalize, -1);
 
     make_patterns();
 

Modified: MacRuby/trunk/spec/frozen/core/float/divmod_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/float/divmod_spec.rb	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/spec/frozen/core/float/divmod_spec.rb	2010-05-13 03:17:50 UTC (rev 4087)
@@ -1,44 +1,59 @@
 require File.expand_path('../../../spec_helper', __FILE__)
 
-describe "Float#divmod" do
-  it "returns an [quotient, modulus] from dividing self by other" do
-    values = 3.14.divmod(2)
-    values[0].should == 1
-    values[1].should be_close(1.14, TOLERANCE)
-    values = 2.8284.divmod(3.1415)
-    values[0].should == 0
-    values[1].should be_close(2.8284, TOLERANCE)
-    values = -1.0.divmod(bignum_value)
-    values[0].should == -1
-    values[1].should be_close(9223372036854775808.000, TOLERANCE)
+describe "Bignum#divmod" do
+  before(:each) do
+    @bignum = bignum_value(55)
   end
 
-  # Behaviour established as correct in r23953
-  it "raises a FloatDomainError if self is NaN" do
-    lambda { nan_value.divmod(1) }.should raise_error(FloatDomainError)
+  # Based on MRI's test/test_integer.rb (test_divmod),
+  # MRI maintains the following property:
+  # if q, r = a.divmod(b) ==>
+  # assert(0 < b ? (0 <= r && r < b) : (b < r && r <= 0))
+  # So, r is always between 0 and b.
+  it "returns an Array containing quotient and modulus obtained from dividing self by the given argument" do
+    @bignum.divmod(4).should == [2305843009213693965, 3]
+    @bignum.divmod(13).should == [709490156681136604, 11]
+
+    @bignum.divmod(4.0).should == [2305843009213693952, 0.0]
+    @bignum.divmod(13.0).should == [709490156681136640, 8.0]
+
+    @bignum.divmod(2.0).should == [4611686018427387904, 0.0]
+    @bignum.divmod(bignum_value).should == [1, 55]
+
+    (-(10**50)).divmod(-(10**40 + 1)).should == [9999999999, -9999999999999999999999999999990000000001]
+    (10**50).divmod(10**40 + 1).should == [9999999999, 9999999999999999999999999999990000000001]
+
+    (-10**50).divmod(10**40 + 1).should == [-10000000000, 10000000000]
+    (10**50).divmod(-(10**40 + 1)).should == [-10000000000, -10000000000]
   end
 
-  # Behaviour established as correct in r23953
-  it "raises a FloatDomainError if other is NaN" do
-    lambda { 1.divmod(nan_value) }.should raise_error(FloatDomainError)
+  it "raises a ZeroDivisionError when the given argument is 0" do
+    lambda { @bignum.divmod(0) }.should raise_error(ZeroDivisionError)
+    lambda { (- at bignum).divmod(0) }.should raise_error(ZeroDivisionError)
   end
 
   # Behaviour established as correct in r23953
-  it "raises a FloatDomainError if self is Infinity" do
-    lambda { infinity_value.divmod(1) }.should raise_error(FloatDomainError)
+  it "raises a FloatDomainError if other is NaN" do
+    lambda { @bignum.divmod(nan_value) }.should raise_error(FloatDomainError)
   end
 
   ruby_version_is ""..."1.9" do
-    it "raises FloatDomainError if other is zero" do
-      lambda { 1.0.divmod(0)   }.should raise_error(FloatDomainError)
-      lambda { 1.0.divmod(0.0) }.should raise_error(FloatDomainError)
+    it "raises a FloatDomainError when the given argument is 0 and a Float" do
+      lambda { @bignum.divmod(0.0) }.should raise_error(FloatDomainError)
+      lambda { (- at bignum).divmod(0.0) }.should raise_error(FloatDomainError)
     end
   end
 
   ruby_version_is "1.9" do
-    it "raises a ZeroDivisionError if other is zero" do
-      lambda { 1.0.divmod(0)   }.should raise_error(ZeroDivisionError)
-      lambda { 1.0.divmod(0.0) }.should raise_error(ZeroDivisionError)
+    it "raises a ZeroDivisionError when the given argument is 0 and a Float" do
+      lambda { @bignum.divmod(0.0) }.should raise_error(ZeroDivisionError)
+      lambda { (- at bignum).divmod(0.0) }.should raise_error(ZeroDivisionError)
     end
   end
-end
+
+  it "raises a TypeError when the given argument is not an Integer" do
+    lambda { @bignum.divmod(mock('10')) }.should raise_error(TypeError)
+    lambda { @bignum.divmod("10") }.should raise_error(TypeError)
+    lambda { @bignum.divmod(:symbol) }.should raise_error(TypeError)
+  end
+end
\ No newline at end of file

Modified: MacRuby/trunk/spec/frozen/core/float/fdiv_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/float/fdiv_spec.rb	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/spec/frozen/core/float/fdiv_spec.rb	2010-05-13 03:17:50 UTC (rev 4087)
@@ -8,7 +8,7 @@
     end
 
     it "performs floating-point division between self and a Fixnum" do
-      8.9.fdiv(7).should == 1.2714285714285716
+      8.9.fdiv(7).should be_close(1.2714285714285716, TOLERANCE)
     end
 
     it "performs floating-point division between self and a Bignum" do

Deleted: MacRuby/trunk/spec/frozen/tags/macruby/core/float/comparison_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/macruby/core/float/comparison_tags.txt	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/spec/frozen/tags/macruby/core/float/comparison_tags.txt	2010-05-13 03:17:50 UTC (rev 4087)
@@ -1,2 +0,0 @@
-fails:Float#<=> returns 1 when self is Infinity and other is a Bignum
-fails:Float#<=> returns -1 when self is negative and other is Infinty

Deleted: MacRuby/trunk/spec/frozen/tags/macruby/core/float/constants_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/macruby/core/float/constants_tags.txt	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/spec/frozen/tags/macruby/core/float/constants_tags.txt	2010-05-13 03:17:50 UTC (rev 4087)
@@ -1,2 +0,0 @@
-fails:Float#CONSTANTS the INFINITY is the positive infinity
-fails:Float#CONSTANTS the NAN is 'not a number'

Deleted: MacRuby/trunk/spec/frozen/tags/macruby/core/float/denominator_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/macruby/core/float/denominator_tags.txt	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/spec/frozen/tags/macruby/core/float/denominator_tags.txt	2010-05-13 03:17:50 UTC (rev 4087)
@@ -1 +0,0 @@
-fails:Float#denominator converts self to a Rational and returns the denominator

Deleted: MacRuby/trunk/spec/frozen/tags/macruby/core/float/divmod_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/macruby/core/float/divmod_tags.txt	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/spec/frozen/tags/macruby/core/float/divmod_tags.txt	2010-05-13 03:17:50 UTC (rev 4087)
@@ -1,4 +0,0 @@
-fails:Float#divmod raises a FloatDomainError if self is NaN
-fails:Float#divmod raises a FloatDomainError if other is NaN
-fails:Float#divmod raises a FloatDomainError if self is Infinity
-fails:Float#divmod raises a ZeroDivisionError if other is zero

Modified: MacRuby/trunk/spec/frozen/tags/macruby/core/float/fdiv_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/macruby/core/float/fdiv_tags.txt	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/spec/frozen/tags/macruby/core/float/fdiv_tags.txt	2010-05-13 03:17:50 UTC (rev 4087)
@@ -1,2 +1 @@
-fails:Float#fdiv performs floating-point division between self and a Fixnum
 fails:Float#fdiv performs floating-point division between self and a Complex

Deleted: MacRuby/trunk/spec/frozen/tags/macruby/core/float/modulo_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/macruby/core/float/modulo_tags.txt	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/spec/frozen/tags/macruby/core/float/modulo_tags.txt	2010-05-13 03:17:50 UTC (rev 4087)
@@ -1,2 +0,0 @@
-fails:Float#% raises a ZeroDivisionError if other is zero
-fails:Float#modulo raises a ZeroDivisionError if other is zero

Deleted: MacRuby/trunk/spec/frozen/tags/macruby/core/float/numerator_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/macruby/core/float/numerator_tags.txt	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/spec/frozen/tags/macruby/core/float/numerator_tags.txt	2010-05-13 03:17:50 UTC (rev 4087)
@@ -1 +0,0 @@
-fails:Float#numerator converts self to a Rational object then returns its numerator

Modified: MacRuby/trunk/spec/frozen/tags/macruby/core/float/rationalize_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/macruby/core/float/rationalize_tags.txt	2010-05-13 01:49:31 UTC (rev 4086)
+++ MacRuby/trunk/spec/frozen/tags/macruby/core/float/rationalize_tags.txt	2010-05-13 03:17:50 UTC (rev 4087)
@@ -1,5 +1 @@
 fails:Float#rationalize returns self as a simplified Rational with no argument
-fails:Float#rationalize simplifies self to the degree specified by a Rational argument
-fails:Float#rationalize simplifies self to the degree specified by a Float argument
-fails:Float#rationalize raises a FloatDomainError for Infinity
-fails:Float#rationalize raises a FloatDomainError for NaN
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100512/3cc5454c/attachment-0001.html>


More information about the macruby-changes mailing list