[前][次][番号順一覧][スレッド一覧]

ruby-changes:6473

From: shyouhei <ko1@a...>
Date: Thu, 10 Jul 2008 13:55:06 +0900 (JST)
Subject: [ruby-changes:6473] Ruby:r17989 (ruby_1_8_7): merge revision(s) 17842:

shyouhei	2008-07-10 13:54:53 +0900 (Thu, 10 Jul 2008)

  New Revision: 17989

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=17989

  Log:
    merge revision(s) 17842:
    * include/ruby/ruby.h (POSFIXABLE): use FIXNUM_MAX+1 instead of
      FIXNUM_MAX to make it possible to convert to double accurately.
      It assumes FLT_RADIX is 2.
      fix RubyForge bug #14102.
      backported from 1.9.

  Modified files:
    branches/ruby_1_8_7/ChangeLog
    branches/ruby_1_8_7/ruby.h
    branches/ruby_1_8_7/test/ruby/test_float.rb
    branches/ruby_1_8_7/version.h

Index: ruby_1_8_7/ChangeLog
===================================================================
--- ruby_1_8_7/ChangeLog	(revision 17988)
+++ ruby_1_8_7/ChangeLog	(revision 17989)
@@ -1,3 +1,11 @@
+Thu Jul 10 13:53:08 2008  Tanaka Akira  <akr@f...>
+
+	* include/ruby/ruby.h (POSFIXABLE): use FIXNUM_MAX+1 instead of
+	  FIXNUM_MAX to make it possible to convert to double accurately.
+	  It assumes FLT_RADIX is 2.
+	  fix RubyForge bug #14102.
+	  backported from 1.9.
+
 Mon Jul  7 16:21:38 2008  Yukihiro Matsumoto  <matz@r...>
 
 	* lib/net/smtp.rb (Net::SMTP::start): use 'localhost' instead of
Index: ruby_1_8_7/version.h
===================================================================
--- ruby_1_8_7/version.h	(revision 17988)
+++ ruby_1_8_7/version.h	(revision 17989)
@@ -1,15 +1,15 @@
 #define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2008-07-07"
+#define RUBY_RELEASE_DATE "2008-07-10"
 #define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20080707
-#define RUBY_PATCHLEVEL 50
+#define RUBY_RELEASE_CODE 20080710
+#define RUBY_PATCHLEVEL 51
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
 #define RUBY_VERSION_TEENY 7
 #define RUBY_RELEASE_YEAR 2008
 #define RUBY_RELEASE_MONTH 7
-#define RUBY_RELEASE_DAY 7
+#define RUBY_RELEASE_DAY 10
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];
Index: ruby_1_8_7/ruby.h
===================================================================
--- ruby_1_8_7/ruby.h	(revision 17988)
+++ ruby_1_8_7/ruby.h	(revision 17989)
@@ -166,7 +166,7 @@
 #define FIX2LONG(x) RSHIFT((long)x,1)
 #define FIX2ULONG(x) (((unsigned long)(x))>>1)
 #define FIXNUM_P(f) (((long)(f))&FIXNUM_FLAG)
-#define POSFIXABLE(f) ((f) <= FIXNUM_MAX)
+#define POSFIXABLE(f) ((f) < FIXNUM_MAX+1)
 #define NEGFIXABLE(f) ((f) >= FIXNUM_MIN)
 #define FIXABLE(f) (POSFIXABLE(f) && NEGFIXABLE(f))
 
Index: ruby_1_8_7/test/ruby/test_float.rb
===================================================================
--- ruby_1_8_7/test/ruby/test_float.rb	(revision 17988)
+++ ruby_1_8_7/test/ruby/test_float.rb	(revision 17989)
@@ -110,4 +110,38 @@
     assert_equal(-3.5, (-11.5).remainder(4))
     assert_equal(-3.5, (-11.5).remainder(-4))
   end
+
+  def test_to_i
+    assert_operator(4611686018427387905.0.to_i, :>, 0)
+    assert_operator(4611686018427387904.0.to_i, :>, 0)
+    assert_operator(4611686018427387903.8.to_i, :>, 0)
+    assert_operator(4611686018427387903.5.to_i, :>, 0)
+    assert_operator(4611686018427387903.2.to_i, :>, 0)
+    assert_operator(4611686018427387903.0.to_i, :>, 0)
+    assert_operator(4611686018427387902.0.to_i, :>, 0)
+
+    assert_operator(1073741825.0.to_i, :>, 0)
+    assert_operator(1073741824.0.to_i, :>, 0)
+    assert_operator(1073741823.8.to_i, :>, 0)
+    assert_operator(1073741823.5.to_i, :>, 0)
+    assert_operator(1073741823.2.to_i, :>, 0)
+    assert_operator(1073741823.0.to_i, :>, 0)
+    assert_operator(1073741822.0.to_i, :>, 0)
+
+    assert_operator((-1073741823.0).to_i, :<, 0)
+    assert_operator((-1073741824.0).to_i, :<, 0)
+    assert_operator((-1073741824.2).to_i, :<, 0)
+    assert_operator((-1073741824.5).to_i, :<, 0)
+    assert_operator((-1073741824.8).to_i, :<, 0)
+    assert_operator((-1073741825.0).to_i, :<, 0)
+    assert_operator((-1073741826.0).to_i, :<, 0)
+
+    assert_operator((-4611686018427387903.0).to_i, :<, 0)
+    assert_operator((-4611686018427387904.0).to_i, :<, 0)
+    assert_operator((-4611686018427387904.2).to_i, :<, 0)
+    assert_operator((-4611686018427387904.5).to_i, :<, 0)
+    assert_operator((-4611686018427387904.8).to_i, :<, 0)
+    assert_operator((-4611686018427387905.0).to_i, :<, 0)
+    assert_operator((-4611686018427387906.0).to_i, :<, 0)
+  end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]