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

ruby-changes:12407

From: wyhaines <ko1@a...>
Date: Wed, 15 Jul 2009 00:05:43 +0900 (JST)
Subject: [ruby-changes:12407] Ruby:r24107 (ruby_1_8_6): Fixes to bignum/numeric so that infinity is always greater than any num.

wyhaines	2009-07-15 00:05:27 +0900 (Wed, 15 Jul 2009)

  New Revision: 24107

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

  Log:
    Fixes to bignum/numeric so that infinity is always greater than any num.
    configure.in fixes to earlier breakage regarding using $libdir for determining lib dirs, instead of $prefix/lib.

  Modified files:
    branches/ruby_1_8_6/ChangeLog
    branches/ruby_1_8_6/bignum.c
    branches/ruby_1_8_6/configure.in
    branches/ruby_1_8_6/numeric.c
    branches/ruby_1_8_6/version.h

Index: ruby_1_8_6/numeric.c
===================================================================
--- ruby_1_8_6/numeric.c	(revision 24106)
+++ ruby_1_8_6/numeric.c	(revision 24107)
@@ -933,6 +933,10 @@
 	break;
 
       case T_BIGNUM:
+	if (isinf(a)) {
+	    if (a > 0.0) return INT2FIX(1);
+	    else return INT2FIX(-1);
+	}
 	b = rb_big2dbl(y);
 	break;
 
Index: ruby_1_8_6/configure.in
===================================================================
--- ruby_1_8_6/configure.in	(revision 24106)
+++ ruby_1_8_6/configure.in	(revision 24107)
@@ -1323,6 +1323,10 @@
   prefix=$ac_default_prefix
 fi
 
+if test "$exec_prefix" = NONE; then
+  exec_prefix=$prefix
+fi
+
 #if test "$fat_binary" != no ; then
 #  CFLAGS="$CFLAGS $ARCH_FLAG"
 #fi
@@ -1614,7 +1618,7 @@
     RUBY_LIB_PREFIX="/lib/ruby"
     ;;
   *)
-    RUBY_LIB_PREFIX="${libdir}/ruby"
+    RUBY_LIB_PREFIX="`eval "echo ${libdir}"`/ruby"
     ;;
 esac
 RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${MAJOR}.${MINOR}"
@@ -1622,7 +1626,7 @@
 AC_ARG_WITH(sitedir,
 	    [  --with-sitedir=DIR      site libraries in DIR [PREFIX/lib/ruby/site_ruby]],
             [sitedir=$withval],
-            [sitedir='${libdir}/ruby/site_ruby'])
+            [sitedir="`eval "echo ${libdir}"`/lib/ruby/site_ruby"])
 SITE_DIR=`eval echo \\"${sitedir}\\"`
 case "$target_os" in
   cygwin*|mingw*|*djgpp*|os2-emx*)
Index: ruby_1_8_6/ChangeLog
===================================================================
--- ruby_1_8_6/ChangeLog	(revision 24106)
+++ ruby_1_8_6/ChangeLog	(revision 24107)
@@ -1,3 +1,9 @@
+Mon Jul 13 12:00:00 2009 Kirk Haines <khaines@r...>
+
+	* numeric.c, bignum.c: Applied changes from r23730. Infinity is > any bignum number in comparisons.
+
+	* configure.in: fixed problems with using $libdir instead of $prefix/lib for RUBY_LIB and friends.
+
 Fri Jul 10 04:00:00 2009 Kirk Haines <khaines@r...>
 
 	* file.c: Added FCNTL inclusion to fix a compile error with solaris (backport from r22812)
Index: ruby_1_8_6/version.h
===================================================================
--- ruby_1_8_6/version.h	(revision 24106)
+++ ruby_1_8_6/version.h	(revision 24107)
@@ -2,7 +2,7 @@
 #define RUBY_RELEASE_DATE "2009-06-08"
 #define RUBY_VERSION_CODE 186
 #define RUBY_RELEASE_CODE 20090608
-#define RUBY_PATCHLEVEL 378
+#define RUBY_PATCHLEVEL 379
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
@@ -18,7 +18,3 @@
 RUBY_EXTERN const int ruby_patchlevel;
 #endif
 
-
-
-
-
Index: ruby_1_8_6/bignum.c
===================================================================
--- ruby_1_8_6/bignum.c	(revision 24106)
+++ ruby_1_8_6/bignum.c	(revision 24107)
@@ -987,7 +987,15 @@
 	break;
 
       case T_FLOAT:
-	return rb_dbl_cmp(rb_big2dbl(x), RFLOAT(y)->value);
+       {
+           double a = RFLOAT(y)->value;
+       
+           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);

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

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