diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-30 13:25:48 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-30 13:25:48 +0000 |
commit | c0e3f62a757de9393ef363f2363a7daeddf86e7b (patch) | |
tree | 7c2121d26b408f4498a50f2f4e7ae48fa63a298b /rational.c | |
parent | f68760070127530a2f06205d3f71a594582fe7f7 (diff) | |
download | ruby-c0e3f62a757de9393ef363f2363a7daeddf86e7b.tar.gz ruby-c0e3f62a757de9393ef363f2363a7daeddf86e7b.tar.xz ruby-c0e3f62a757de9393ef363f2363a7daeddf86e7b.zip |
* rational.c: added a static variable for nurat_to_f.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'rational.c')
-rw-r--r-- | rational.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/rational.c b/rational.c index e0fe2a20c..44091081a 100644 --- a/rational.c +++ b/rational.c @@ -1020,6 +1020,8 @@ i_ilog2(VALUE x) return q + r; } +static long ml; + static VALUE nurat_to_f(VALUE self) { @@ -1465,6 +1467,8 @@ Init_Rational(void) 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); |