ruby-changes:7434
From: tadf <ko1@a...>
Date: Sat, 30 Aug 2008 22:26:04 +0900 (JST)
Subject: [ruby-changes:7434] Ruby:r18953 (trunk): * rational.c: added a static variable for nurat_to_f.
tadf 2008-08-30 22:25:48 +0900 (Sat, 30 Aug 2008) New Revision: 18953 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18953 Log: * rational.c: added a static variable for nurat_to_f. Modified files: trunk/ChangeLog trunk/rational.c trunk/test/ruby/test_complex.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 18952) +++ ChangeLog (revision 18953) @@ -1,3 +1,7 @@ +Sat Aug 30 22:23:31 2008 Tadayoshi Funaba <tadf@d...> + + * rational.c: added a static variable for nurat_to_f. + Sat Aug 30 20:05:41 2008 NAKAMURA Usaku <usa@r...> * win32/win32.c (rb_w32_open, rb_w32_read, rb_w32_write): fallback to Index: test/ruby/test_complex.rb =================================================================== --- test/ruby/test_complex.rb (revision 18952) +++ test/ruby/test_complex.rb (revision 18953) @@ -283,12 +283,12 @@ assert_equal(Complex(1,1), Complex(1,1).nonzero?) end - def rect + def test_rect assert_equal([1,2], Complex.rectangular(1,2).rectangular) assert_equal([1,2], Complex.rect(1,2).rect) end - def polar + def test_polar assert_equal([1,2], Complex.polar(1,2).polar) end Index: rational.c =================================================================== --- rational.c (revision 18952) +++ rational.c (revision 18953) @@ -1020,6 +1020,8 @@ return q + r; } +static long ml; + static VALUE nurat_to_f(VALUE self) { @@ -1465,6 +1467,8 @@ id_to_s = rb_intern("to_s"); id_truncate = rb_intern("truncate"); + ml = (long)(log(DBL_MAX) / log(2.0) - 1); + rb_cRational = rb_define_class(RATIONAL_NAME, rb_cNumeric); rb_define_alloc_func(rb_cRational, nurat_s_alloc); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/