diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | bignum.c | 16 | ||||
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | marshal.c | 5 | ||||
-rw-r--r-- | random.c | 5 | ||||
-rw-r--r-- | version.h | 4 |
6 files changed, 21 insertions, 15 deletions
@@ -1,3 +1,8 @@ +Thu Nov 2 18:01:16 2000 Yukihiro Matsumoto <matz@ruby-lang.org> + + * random.c (rb_f_rand): half-baked float support fixed. This fix + was originally proposed by K.Kosako <kosako@sofnec.co.jp>. + Tue Oct 31 17:27:17 2000 Yukihiro Matsumoto <matz@ruby-lang.org> * bignum.c: change digit size to `long|int' if long long is @@ -20,14 +20,14 @@ VALUE rb_cBignum; #define USHORT _USHORT #endif -#if SIZEOF_LONG*2 <= SIZEOF_LONG_LONG -typedef unsigned long BDIGIT; -typedef unsigned long long BDIGIT_DBL; -typedef long long BDIGIT_DBL_SIGNED; -#elif SIZEOF_INT*2 <= SIZEOF_LONG_LONG +#if SIZEOF_INT*2 <= SIZEOF_LONG_LONG typedef unsigned int BDIGIT; typedef unsigned long long BDIGIT_DBL; typedef long long BDIGIT_DBL_SIGNED; +#elif SIZEOF_INT*2 <= SIZEOF___INT64 +typedef unsigned int BDIGIT; +typedef unsigned __int64 BDIGIT_DBL; +typedef __int64 BDIGIT_DBL_SIGNED; #else typedef unsigned short BDIGIT; typedef unsigned long BDIGIT_DBL; @@ -469,7 +469,7 @@ dbl2big(d) double d; { long i = 0; - long c; + BDIGIT c; BDIGIT *digits; VALUE z; double u = (d < 0)?-d:d; @@ -489,9 +489,9 @@ dbl2big(d) digits = BDIGITS(z); while (i--) { u *= BIGRAD; - c = (long)u; + c = (BDIGIT)u; u -= c; - digits[i] = (BDIGIT)c; + digits[i] = c; } return z; diff --git a/configure.in b/configure.in index a87e098e43..fac0265e95 100644 --- a/configure.in +++ b/configure.in @@ -113,6 +113,7 @@ AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(long long, 0) +AC_CHECK_SIZEOF(__int64, 0) AC_CHECK_SIZEOF(void*, 4) AC_CHECK_SIZEOF(float, 4) AC_CHECK_SIZEOF(double, 8) @@ -18,10 +18,7 @@ double strtod(); #endif -#if SIZEOF_LONG*2 <= SIZEOF_LONG_LONG -typedef unsigned long BDIGIT; -#define SIZEOF_BDIGITS SIZEOF_LONG -#elif SIZEOF_INT*2 <= SIZEOF_LONG_LONG +#if SIZEOF_INT*2 <= SIZEOF_LONG_LONG || SIZEOF_INT*2 <= SIZEOF___INT64 typedef unsigned int BDIGIT; #define SIZEOF_BDIGITS SIZEOF_INT #else @@ -147,8 +147,11 @@ rb_f_rand(argc, argv, obj) } switch (TYPE(vmax)) { case T_FLOAT: - if (RFLOAT(vmax)->value <= LONG_MAX && RFLOAT(vmax)->value >= LONG_MIN) + if (RFLOAT(vmax)->value <= LONG_MAX && RFLOAT(vmax)->value >= LONG_MIN) { + max = (long)RFLOAT(vmax)->value; break; + } + vmax = rb_dbl2big(RFLOAT(vmax)->value); /* fall through */ case T_BIGNUM: return rb_big_rand(vmax, RANDOM_NUMBER); @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.6.2" -#define RUBY_RELEASE_DATE "2000-11-01" +#define RUBY_RELEASE_DATE "2000-11-02" #define RUBY_VERSION_CODE 162 -#define RUBY_RELEASE_CODE 20001101 +#define RUBY_RELEASE_CODE 20001102 |