mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* rational.c: added a static variable for nurat_to_f.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7b2f9d9238
commit
74f9ec7e4f
3 changed files with 10 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Sat Aug 30 22:23:31 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* rational.c: added a static variable for nurat_to_f.
|
||||||
|
|
||||||
Sat Aug 30 20:05:41 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
Sat Aug 30 20:05:41 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* win32/win32.c (rb_w32_open, rb_w32_read, rb_w32_write): fallback to
|
* win32/win32.c (rb_w32_open, rb_w32_read, rb_w32_write): fallback to
|
||||||
|
|
|
@ -1020,6 +1020,8 @@ i_ilog2(VALUE x)
|
||||||
return q + r;
|
return q + r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static long ml;
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
nurat_to_f(VALUE self)
|
nurat_to_f(VALUE self)
|
||||||
{
|
{
|
||||||
|
@ -1465,6 +1467,8 @@ Init_Rational(void)
|
||||||
id_to_s = rb_intern("to_s");
|
id_to_s = rb_intern("to_s");
|
||||||
id_truncate = rb_intern("truncate");
|
id_truncate = rb_intern("truncate");
|
||||||
|
|
||||||
|
ml = (long)(log(DBL_MAX) / log(2.0) - 1);
|
||||||
|
|
||||||
rb_cRational = rb_define_class(RATIONAL_NAME, rb_cNumeric);
|
rb_cRational = rb_define_class(RATIONAL_NAME, rb_cNumeric);
|
||||||
|
|
||||||
rb_define_alloc_func(rb_cRational, nurat_s_alloc);
|
rb_define_alloc_func(rb_cRational, nurat_s_alloc);
|
||||||
|
|
|
@ -283,12 +283,12 @@ class Complex_Test < Test::Unit::TestCase
|
||||||
assert_equal(Complex(1,1), Complex(1,1).nonzero?)
|
assert_equal(Complex(1,1), Complex(1,1).nonzero?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def rect
|
def test_rect
|
||||||
assert_equal([1,2], Complex.rectangular(1,2).rectangular)
|
assert_equal([1,2], Complex.rectangular(1,2).rectangular)
|
||||||
assert_equal([1,2], Complex.rect(1,2).rect)
|
assert_equal([1,2], Complex.rect(1,2).rect)
|
||||||
end
|
end
|
||||||
|
|
||||||
def polar
|
def test_polar
|
||||||
assert_equal([1,2], Complex.polar(1,2).polar)
|
assert_equal([1,2], Complex.polar(1,2).polar)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue