ruby-changes:7639
From: matz <ko1@a...>
Date: Sat, 6 Sep 2008 03:24:45 +0900 (JST)
Subject: [ruby-changes:7639] Ruby:r19160 (trunk): * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.
matz 2008-09-06 03:24:21 +0900 (Sat, 06 Sep 2008) New Revision: 19160 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19160 Log: * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM. a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp> in [ruby-dev:36102]. Modified files: trunk/ChangeLog trunk/bignum.c trunk/gc.c trunk/include/ruby/ruby.h trunk/insns.def trunk/marshal.c trunk/math.c trunk/numeric.c trunk/object.c trunk/pack.c trunk/parse.y trunk/process.c trunk/random.c trunk/string.c trunk/time.c Index: math.c =================================================================== --- math.c (revision 19159) +++ math.c (revision 19160) @@ -85,7 +85,7 @@ math_atan2(VALUE obj, VALUE y, VALUE x) { Need_Float2(y, x); - return DOUBLE2NUM(atan2(RFLOAT_VALUE(y), RFLOAT_VALUE(x))); + return DBL2NUM(atan2(RFLOAT_VALUE(y), RFLOAT_VALUE(x))); } @@ -101,7 +101,7 @@ math_cos(VALUE obj, VALUE x) { Need_Float(x); - return DOUBLE2NUM(cos(RFLOAT_VALUE(x))); + return DBL2NUM(cos(RFLOAT_VALUE(x))); } /* @@ -117,7 +117,7 @@ { Need_Float(x); - return DOUBLE2NUM(sin(RFLOAT_VALUE(x))); + return DBL2NUM(sin(RFLOAT_VALUE(x))); } @@ -133,7 +133,7 @@ { Need_Float(x); - return DOUBLE2NUM(tan(RFLOAT_VALUE(x))); + return DBL2NUM(tan(RFLOAT_VALUE(x))); } /* @@ -152,7 +152,7 @@ errno = 0; d = acos(RFLOAT_VALUE(x)); domain_check(d, "acos"); - return DOUBLE2NUM(d); + return DBL2NUM(d); } /* @@ -171,7 +171,7 @@ errno = 0; d = asin(RFLOAT_VALUE(x)); domain_check(d, "asin"); - return DOUBLE2NUM(d); + return DBL2NUM(d); } /* @@ -185,7 +185,7 @@ math_atan(VALUE obj, VALUE x) { Need_Float(x); - return DOUBLE2NUM(atan(RFLOAT_VALUE(x))); + return DBL2NUM(atan(RFLOAT_VALUE(x))); } #ifndef HAVE_COSH @@ -208,7 +208,7 @@ { Need_Float(x); - return DOUBLE2NUM(cosh(RFLOAT_VALUE(x))); + return DBL2NUM(cosh(RFLOAT_VALUE(x))); } #ifndef HAVE_SINH @@ -231,7 +231,7 @@ math_sinh(VALUE obj, VALUE x) { Need_Float(x); - return DOUBLE2NUM(sinh(RFLOAT_VALUE(x))); + return DBL2NUM(sinh(RFLOAT_VALUE(x))); } #ifndef HAVE_TANH @@ -254,7 +254,7 @@ math_tanh(VALUE obj, VALUE x) { Need_Float(x); - return DOUBLE2NUM(tanh(RFLOAT_VALUE(x))); + return DBL2NUM(tanh(RFLOAT_VALUE(x))); } /* @@ -273,7 +273,7 @@ errno = 0; d = acosh(RFLOAT_VALUE(x)); domain_check(d, "acosh"); - return DOUBLE2NUM(d); + return DBL2NUM(d); } /* @@ -287,7 +287,7 @@ math_asinh(VALUE obj, VALUE x) { Need_Float(x); - return DOUBLE2NUM(asinh(RFLOAT_VALUE(x))); + return DBL2NUM(asinh(RFLOAT_VALUE(x))); } /* @@ -307,7 +307,7 @@ d = atanh(RFLOAT_VALUE(x)); domain_check(d, "atanh"); infinity_check(x, d, "atanh"); - return DOUBLE2NUM(d); + return DBL2NUM(d); } /* @@ -321,7 +321,7 @@ math_exp(VALUE obj, VALUE x) { Need_Float(x); - return DOUBLE2NUM(exp(RFLOAT_VALUE(x))); + return DBL2NUM(exp(RFLOAT_VALUE(x))); } #if defined __CYGWIN__ @@ -359,7 +359,7 @@ } domain_check(d, "log"); infinity_check(x, d, "log"); - return DOUBLE2NUM(d); + return DBL2NUM(d); } #ifndef log2 @@ -391,7 +391,7 @@ d = log2(RFLOAT_VALUE(x)); domain_check(d, "log2"); infinity_check(x, d, "log2"); - return DOUBLE2NUM(d); + return DBL2NUM(d); } /* @@ -411,7 +411,7 @@ d = log10(RFLOAT_VALUE(x)); domain_check(d, "log10"); infinity_check(x, d, "log10"); - return DOUBLE2NUM(d); + return DBL2NUM(d); } /* @@ -447,7 +447,7 @@ errno = 0; d = sqrt(RFLOAT_VALUE(x)); domain_check(d, "sqrt"); - return DOUBLE2NUM(d); + return DBL2NUM(d); } /* @@ -486,7 +486,7 @@ math_cbrt(VALUE obj, VALUE x) { Need_Float(x); - return DOUBLE2NUM(cbrt(RFLOAT_VALUE(x))); + return DBL2NUM(cbrt(RFLOAT_VALUE(x))); } /* @@ -510,7 +510,7 @@ Need_Float(x); d = frexp(RFLOAT_VALUE(x), &exp); - return rb_assoc_new(DOUBLE2NUM(d), INT2NUM(exp)); + return rb_assoc_new(DBL2NUM(d), INT2NUM(exp)); } /* @@ -527,7 +527,7 @@ math_ldexp(VALUE obj, VALUE x, VALUE n) { Need_Float(x); - return DOUBLE2NUM(ldexp(RFLOAT_VALUE(x), NUM2INT(n))); + return DBL2NUM(ldexp(RFLOAT_VALUE(x), NUM2INT(n))); } /* @@ -544,7 +544,7 @@ math_hypot(VALUE obj, VALUE x, VALUE y) { Need_Float2(x, y); - return DOUBLE2NUM(hypot(RFLOAT_VALUE(x), RFLOAT_VALUE(y))); + return DBL2NUM(hypot(RFLOAT_VALUE(x), RFLOAT_VALUE(y))); } /* @@ -558,7 +558,7 @@ math_erf(VALUE obj, VALUE x) { Need_Float(x); - return DOUBLE2NUM(erf(RFLOAT_VALUE(x))); + return DBL2NUM(erf(RFLOAT_VALUE(x))); } /* @@ -572,7 +572,7 @@ math_erfc(VALUE obj, VALUE x) { Need_Float(x); - return DOUBLE2NUM(erfc(RFLOAT_VALUE(x))); + return DBL2NUM(erfc(RFLOAT_VALUE(x))); } /* @@ -624,7 +624,7 @@ errno = 0; d = tgamma(RFLOAT_VALUE(x)); domain_check(d, "gamma"); - return DOUBLE2NUM(d); + return DBL2NUM(d); } /* @@ -649,7 +649,7 @@ errno = 0; d = lgamma_r(RFLOAT_VALUE(x), &sign); domain_check(d, "lgamma"); - v = DOUBLE2NUM(d); + v = DBL2NUM(d); return rb_assoc_new(v, INT2FIX(sign)); } @@ -667,15 +667,15 @@ rb_mMath = rb_define_module("Math"); #ifdef M_PI - rb_define_const(rb_mMath, "PI", DOUBLE2NUM(M_PI)); + rb_define_const(rb_mMath, "PI", DBL2NUM(M_PI)); #else - rb_define_const(rb_mMath, "PI", DOUBLE2NUM(atan(1.0)*4.0)); + rb_define_const(rb_mMath, "PI", DBL2NUM(atan(1.0)*4.0)); #endif #ifdef M_E - rb_define_const(rb_mMath, "E", DOUBLE2NUM(M_E)); + rb_define_const(rb_mMath, "E", DBL2NUM(M_E)); #else - rb_define_const(rb_mMath, "E", DOUBLE2NUM(exp(1.0))); + rb_define_const(rb_mMath, "E", DBL2NUM(exp(1.0))); #endif rb_define_module_function(rb_mMath, "atan2", math_atan2, 2); Index: time.c =================================================================== --- time.c (revision 19159) +++ time.c (revision 19160) @@ -1016,7 +1016,7 @@ struct time_object *tobj; GetTimeval(time, tobj); - return DOUBLE2NUM((double)tobj->ts.tv_sec+(double)tobj->ts.tv_nsec/1e9); + return DBL2NUM((double)tobj->ts.tv_sec+(double)tobj->ts.tv_nsec/1e9); } /* @@ -1513,7 +1513,7 @@ f = (double)(unsigned_time_t)(tobj->ts.tv_sec - tobj2->ts.tv_sec); f += ((double)tobj->ts.tv_nsec - (double)tobj2->ts.tv_nsec)*1e-9; - return DOUBLE2NUM(f); + return DBL2NUM(f); } return time_add(tobj, time2, -1); } Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 19159) +++ include/ruby/ruby.h (revision 19160) @@ -568,7 +568,7 @@ double float_value; }; #define RFLOAT_VALUE(v) (RFLOAT(v)->float_value) -#define DOUBLE2NUM(dbl) rb_float_new(dbl) +#define DBL2NUM(dbl) rb_float_new(dbl) #define ELTS_SHARED FL_USER2 Index: insns.def =================================================================== --- insns.def (revision 19159) +++ insns.def (revision 19160) @@ -1319,7 +1319,7 @@ else if (HEAP_CLASS_OF(recv) == rb_cFloat && HEAP_CLASS_OF(obj) == rb_cFloat && BASIC_OP_UNREDEFINED_P(BOP_PLUS)) { - val = DOUBLE2NUM(RFLOAT_VALUE(recv) + RFLOAT_VALUE(obj)); + val = DBL2NUM(RFLOAT_VALUE(recv) + RFLOAT_VALUE(obj)); } #endif @@ -1420,7 +1420,7 @@ else if (HEAP_CLASS_OF(recv) == rb_cFloat && HEAP_CLASS_OF(obj) == rb_cFloat && BASIC_OP_UNREDEFINED_P(BOP_MULT)) { - val = DOUBLE2NUM(RFLOAT_VALUE(recv) * RFLOAT_VALUE(obj)); + val = DBL2NUM(RFLOAT_VALUE(recv) * RFLOAT_VALUE(obj)); } #endif else { @@ -1484,7 +1484,7 @@ else if (HEAP_CLASS_OF(recv) == rb_cFloat && HEAP_CLASS_OF(obj) == rb_cFloat && BASIC_OP_UNREDEFINED_P(BOP_DIV)) { - val = DOUBLE2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj)); + val = DBL2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj)); } #endif else { @@ -1564,7 +1564,7 @@ mod += y; div -= 1.0; } - val = DOUBLE2NUM(mod); + val = DBL2NUM(mod); } else { goto INSN_LABEL(normal_dispatch); Index: ChangeLog =================================================================== --- ChangeLog (revision 19159) +++ ChangeLog (revision 19160) @@ -1,3 +1,9 @@ +Sat Sep 6 06:05:09 2008 Yukihiro Matsumoto <matz@r...> + + * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM. + a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp> + in [ruby-dev:36102]. + Sat Sep 6 03:18:17 2008 Tanaka Akira <akr@f...> * transcode.c (allocate_converted_string): add arguments for a buffer Index: string.c =================================================================== --- string.c (revision 19159) +++ string.c (revision 19160) @@ -3763,7 +3763,7 @@ static VALUE rb_str_to_f(VALUE str) { - return DOUBLE2NUM(rb_str_to_dbl(str, Qfalse)); + return DBL2NUM(rb_str_to_dbl(str, Qfalse)); } Index: object.c =================================================================== --- object.c (revision 19159) +++ object.c (revision 19160) @@ -850,7 +850,7 @@ static VALUE nil_to_f(VALUE obj) { - return DOUBLE2NUM(0.0); + return DBL2NUM(0.0); } /* @@ -2230,16 +2230,16 @@ { switch (TYPE(val)) { case T_FIXNUM: - return DOUBLE2NUM((double)FIX2LONG(val)); + return DBL2NUM((double)FIX2LONG(val)); case T_FLOAT: return val; case T_BIGNUM: - return DOUBLE2NUM(rb_big2dbl(val)); + return DBL2NUM(rb_big2dbl(val)); case T_STRING: - return DOUBLE2NUM(rb_str_to_dbl(val, Qtrue)); + return DBL2NUM(rb_str_to_dbl(val, Qtrue)); case T_NIL: rb_raise(rb_eTypeError, "can't convert nil into Float"); Index: pack.c =================================================================== --- pack.c (revision 19159) +++ pack.c (revision 19160) @@ -1649,7 +1649,7 @@ float tmp; memcpy(&tmp, s, sizeof(float)); s += sizeof(float); - UNPACK_PUSH(DOUBLE2NUM((double)tmp)); + UNPACK_PUSH(DBL2NUM((double)tmp)); } PACK_ITEM_ADJUST(); break; @@ -1663,7 +1663,7 @@ memcpy(&tmp, s, sizeof(float)); s += sizeof(float); tmp = VTOHF(tmp,ftmp); - UNPACK_PUSH(DOUBLE2NUM((double)tmp)); + UNPACK_PUSH(DBL2NUM((double)tmp)); } PACK_ITEM_ADJUST(); break; @@ -1677,7 +1677,7 @@ memcpy(&tmp, s, sizeof(double)); s += sizeof(double); tmp = VTOHD(tmp,dtmp); - UNPACK_PUSH(DOUBLE2NUM(tmp)); + UNPACK_PUSH(DBL2NUM(tmp)); } PACK_ITEM_ADJUST(); break; @@ -1689,7 +1689,7 @@ double tmp; memcpy(&tmp, s, sizeof(double)); s += sizeof(double); - UNPACK_PUSH(DOUBLE2NUM(tmp)); + UNPACK_PUSH(DBL2NUM(tmp)); } PACK_ITEM_ADJUST(); break; @@ -1703,7 +1703,7 @@ memcpy(&tmp, s, sizeof(float)); s += sizeof(float); tmp = NTOHF(tmp,ftmp); - UNPACK_PUSH(DOUBLE2NUM((double)tmp)); + UNPACK_PUSH(DBL2NUM((double)tmp)); } PACK_ITEM_ADJUST(); break; @@ -1717,7 +1717,7 @@ memcpy(&tmp, s, sizeof(double)); s += sizeof(double); tmp = NTOHD(tmp,dtmp); - UNPACK_PUSH(DOUBLE2NUM(tmp)); + UNPACK_PUSH(DBL2NUM(tmp)); } PACK_ITEM_ADJUST(); break; Index: gc.c =================================================================== --- gc.c (revision 19159) +++ gc.c (revision 19160) @@ -2696,14 +2696,14 @@ for (i =0; i < objspace->profile.count; i++) { prof = rb_hash_new(); - rb_hash_aset(prof, ID2SYM(rb_intern("GC_TIME")), DOUBLE2NUM(objspace->profile.record[i].gc_time)); - rb_hash_aset(prof, ID2SYM(rb_intern("GC_INVOKE_TIME")), DOUBLE2NUM(objspace->profile.record[i].gc_invoke_time)); + rb_hash_aset(prof, ID2SYM(rb_intern("GC_TIME")), DBL2NUM(objspace->profile.record[i].gc_time)); + rb_hash_aset(prof, ID2SYM(rb_intern("GC_INVOKE_TIME")), DBL2NUM(objspace->profile.record[i].gc_invoke_time)); rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_USE_SIZE")), rb_uint2inum(objspace->profile.record[i].heap_use_size)); rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_TOTAL_SIZE")), rb_uint2inum(objspace->profile.record[i].heap_total_size)); rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_TOTAL_OBJECTS")), rb_uint2inum(objspace->profile.record[i].heap_total_objects)); #if GC_PROFILE_MORE_DETAIL - rb_hash_aset(prof, ID2SYM(rb_intern("GC_MARK_TIME")), DOUBLE2NUM(objspace->profile.record[i].gc_mark_time)); - rb_hash_aset(prof, ID2SYM(rb_intern("GC_SWEEP_TIME")), DOUBLE2NUM(objspace->profile.record[i].gc_sweep_time)); + rb_hash_aset(prof, ID2SYM(rb_intern("GC_MARK_TIME")), DBL2NUM(objspace->profile.record[i].gc_mark_time)); + rb_hash_aset(prof, ID2SYM(rb_intern("GC_SWEEP_TIME")), DBL2NUM(objspace->profile.record[i].gc_sweep_time)); rb_hash_aset(prof, ID2SYM(rb_intern("ALLOCATE_INCREASE")), rb_uint2inum(objspace->profile.record[i].allocate_increase)); rb_hash_aset(prof, ID2SYM(rb_intern("ALLOCATE_LIMIT")), rb_uint2inum(objspace->profile.record[i].allocate_limit)); rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_USE_SLOTS")), rb_uint2inum(objspace->profile.record[i].heap_use_slots)); Index: parse.y =================================================================== --- parse.y (revision 19159) +++ parse.y (revision 19160) @@ -6920,7 +6920,7 @@ rb_warningS("Float %s out of range", tok()); errno = 0; } - set_yylval_literal(DOUBLE2NUM(d)); + set_yylval_literal(DBL2NUM(d)); return tFLOAT; } set_yylval_literal(rb_cstr_to_inum(tok(), 10, Qfalse)); Index: process.c =================================================================== --- process.c (revision 19159) +++ process.c (revision 19160) @@ -5047,10 +5047,10 @@ times(&buf); return rb_struct_new(rb_cProcessTms, - utime = DOUBLE2NUM(buf.tms_utime / hertz), - stime = DOUBLE2NUM(buf.tms_stime / hertz), - cutime = DOUBLE2NUM(buf.tms_cutime / hertz), - sctime = DOUBLE2NUM(buf.tms_cstime / hertz)); + utime = DBL2NUM(buf.tms_utime / hertz), + stime = DBL2NUM(buf.tms_stime / hertz), + cutime = DBL2NUM(buf.tms_cutime / hertz), + sctime = DBL2NUM(buf.tms_cstime / hertz)); #else rb_notimplement(); #endif Index: numeric.c =================================================================== --- numeric.c (revision 19159) +++ numeric.c (revision 19160) @@ -562,7 +562,7 @@ static VALUE flo_uminus(VALUE flt) { - return DOUBLE2NUM(-RFLOAT_VALUE(flt)); + return DBL2NUM(-RFLOAT_VALUE(flt)); } /* @@ -578,11 +578,11 @@ { switch (TYPE(y)) { case T_FIXNUM: - return DOUBLE2NUM(RFLOAT_VALUE(x) + (double)FIX2LONG(y)); + return DBL2NUM(RFLOAT_VALUE(x) + (double)FIX2LONG(y)); case T_BIGNUM: - return DOUBLE2NUM(RFLOAT_VALUE(x) + rb_big2dbl(y)); + return DBL2NUM(RFLOAT_VALUE(x) + rb_big2dbl(y)); case T_FLOAT: - return DOUBLE2NUM(RFLOAT_VALUE(x) + RFLOAT_VALUE(y)); + return DBL2NUM(RFLOAT_VALUE(x) + RFLOAT_VALUE(y)); default: return rb_num_coerce_bin(x, y, '+'); } @@ -601,11 +601,11 @@ { switch (TYPE(y)) { case T_FIXNUM: - return DOUBLE2NUM(RFLOAT_VALUE(x) - (double)FIX2LONG(y)); + return DBL2NUM(RFLOAT_VALUE(x) - (double)FIX2LONG(y)); case T_BIGNUM: - return DOUBLE2NUM(RFLOAT_VALUE(x) - rb_big2dbl(y)); + return DBL2NUM(RFLOAT_VALUE(x) - rb_big2dbl(y)); case T_FLOAT: - return DOUBLE2NUM(RFLOAT_VALUE(x) - RFLOAT_VALUE(y)); + return DBL2NUM(RFLOAT_VALUE(x) - RFLOAT_VALUE(y)); default: return rb_num_coerce_bin(x, y, '-'); } @@ -624,11 +624,11 @@ { switch (TYPE(y)) { case T_FIXNUM: - return DOUBLE2NUM(RFLOAT_VALUE(x) * (double)FIX2LONG(y)); + return DBL2NUM(RFLOAT_VALUE(x) * (double)FIX2LONG(y)); case T_BIGNUM: - return DOUBLE2NUM(RFLOAT_VALUE(x) * rb_big2dbl(y)); + return DBL2NUM(RFLOAT_VALUE(x) * rb_big2dbl(y)); case T_FLOAT: - return DOUBLE2NUM(RFLOAT_VALUE(x) * RFLOAT_VALUE(y)); + return DBL2NUM(RFLOAT_VALUE(x) * RFLOAT_VALUE(y)); default: return rb_num_coerce_bin(x, y, '*'); } @@ -651,12 +651,12 @@ switch (TYPE(y)) { case T_FIXNUM: f_y = FIX2LONG(y); - return DOUBLE2NUM(RFLOAT_VALUE(x) / (double)f_y); + return DBL2NUM(RFLOAT_VALUE(x) / (double)f_y); case T_BIGNUM: d = rb_big2dbl(y); - return DOUBLE2NUM(RFLOAT_VALUE(x) / d); + return DBL2NUM(RFLOAT_VALUE(x) / d); case T_FLOAT: - return DOUBLE2NUM(RFLOAT_VALUE(x) / RFLOAT_VALUE(y)); + return DBL2NUM(RFLOAT_VALUE(x) / RFLOAT_VALUE(y)); default: return rb_num_coerce_bin(x, y, '/'); } @@ -726,7 +726,7 @@ return rb_num_coerce_bin(x, y, '%'); } flodivmod(RFLOAT_VALUE(x), fy, 0, &mod); - return DOUBLE2NUM(mod); + return DBL2NUM(mod); } static VALUE @@ -773,7 +773,7 @@ } flodivmod(RFLOAT_VALUE(x), fy, &div, &mod); a = dbl2ival(div); - b = DOUBLE2NUM(mod); + b = DBL2NUM(mod); return rb_assoc_new(a, b); } @@ -790,11 +790,11 @@ { switch (TYPE(y)) { case T_FIXNUM: - return DOUBLE2NUM(pow(RFLOAT_VALUE(x), (double)FIX2LONG(y))); + return DBL2NUM(pow(RFLOAT_VALUE(x), (double)FIX2LONG(y))); case T_BIGNUM: - return DOUBLE2NUM(pow(RFLOAT_VALUE(x), rb_big2dbl(y))); + return DBL2NUM(pow(RFLOAT_VALUE(x), rb_big2dbl(y))); case T_FLOAT: - return DOUBLE2NUM(pow(RFLOAT_VALUE(x), RFLOAT_VALUE(y))); + return DBL2NUM(pow(RFLOAT_VALUE(x), RFLOAT_VALUE(y))); default: return rb_num_coerce_bin(x, y, rb_intern("**")); } @@ -1130,7 +1130,7 @@ flo_abs(VALUE flt) { double val = fabs(RFLOAT_VALUE(flt)); - return DOUBLE2NUM(val); + return DBL2NUM(val); } /* @@ -1312,7 +1312,7 @@ else number /= f; } - if (ndigits > 0) return DOUBLE2NUM(number); + if (ndigits > 0) return DBL2NUM(number); if (!FIXABLE(number)) { return rb_dbl2big(number); @@ -1501,7 +1501,7 @@ if (err>0.5) err=0.5; n = floor(n + err) + 1; for (i=0; i<n; i++) { - rb_yield(DOUBLE2NUM(i*unit+beg)); + rb_yield(DBL2NUM(i*unit+beg)); } } else { @@ -2106,7 +2106,7 @@ case T_BIGNUM: return rb_big_plus(y, x); case T_FLOAT: - return DOUBLE2NUM((double)FIX2LONG(x) + RFLOAT_VALUE(y)); + return DBL2NUM((double)FIX2LONG(x) + RFLOAT_VALUE(y)); default: return rb_num_coerce_bin(x, y, '+'); } @@ -2140,7 +2140,7 @@ x = rb_int2big(FIX2LONG(x)); return rb_big_minus(x, y); case T_FLOAT: - return DOUBLE2NUM((double)FIX2LONG(x) - RFLOAT_VALUE(y)); + return DBL2NUM((double)FIX2LONG(x) - RFLOAT_VALUE(y)); default: return rb_num_coerce_bin(x, y, '-'); } @@ -2199,7 +2199,7 @@ case T_BIGNUM: return rb_big_mul(y, x); case T_FLOAT: - return DOUBLE2NUM((double)FIX2LONG(x) * RFLOAT_VALUE(y)); + return DBL2NUM((double)FIX2LONG(x) * RFLOAT_VALUE(y)); default: return rb_num_coerce_bin(x, y, '*'); } @@ -2248,13 +2248,13 @@ fix_fdiv(VALUE x, VALUE y) { if (FIXNUM_P(y)) { - return DOUBLE2NUM((double)FIX2LONG(x) / (double)FIX2LONG(y)); + return DBL2NUM((double)FIX2LONG(x) / (double)FIX2LONG(y)); } switch (TYPE(y)) { case T_BIGNUM: - return DOUBLE2NUM((double)FIX2LONG(x) / rb_big2dbl(y)); + return DBL2NUM((double)FIX2LONG(x) / rb_big2dbl(y)); case T_FLOAT: - return DOUBLE2NUM((double)FIX2LONG(x) / RFLOAT_VALUE(y)); + return DBL2NUM((double)FIX2LONG(x) / RFLOAT_VALUE(y)); default: return rb_num_coerce_bin(x, y, rb_intern("fdiv")); } @@ -2279,7 +2279,7 @@ if (op == '/') { div = (double)FIX2LONG(x) / RFLOAT_VALUE(y); - return DOUBLE2NUM(div); + return DBL2NUM(div); } else { if (RFLOAT_VALUE(y) == 0) rb_num_zerodiv(); @@ -2347,7 +2347,7 @@ double mod; flodivmod((double)FIX2LONG(x), RFLOAT_VALUE(y), 0, &mod); - return DOUBLE2NUM(mod); + return DBL2NUM(mod); } default: return rb_num_coerce_bin(x, y, '%'); @@ -2381,7 +2381,7 @@ flodivmod((double)FIX2LONG(x), RFLOAT_VALUE(y), &div, &mod); a = dbl2ival(div); - b = DOUBLE2NUM(mod); + b = DBL2NUM(mod); return rb_assoc_new(a, b); } default: @@ -2453,7 +2453,7 @@ if (b == 1) return x; if (a == 0) { if (b > 0) return INT2FIX(0); - return DOUBLE2NUM(1.0 / zero); + return DBL2NUM(1.0 / zero); } if (a == 1) return INT2FIX(1); if (a == -1) { @@ -2479,12 +2479,12 @@ x = rb_int2big(FIX2LONG(x)); return rb_big_pow(x, y); case T_FLOAT: - if (RFLOAT_VALUE(y) == 0.0) return DOUBLE2NUM(1.0); + if (RFLOAT_VALUE(y) == 0.0) return DBL2NUM(1.0); if (a == 0) { - return DOUBLE2NUM(RFLOAT_VALUE(y) < 0 ? (1.0 / zero) : 0.0); + return DBL2NUM(RFLOAT_VALUE(y) < 0 ? (1.0 / zero) : 0.0); } - if (a == 1) return DOUBLE2NUM(1.0); - return DOUBLE2NUM(pow((double)a, RFLOAT_VALUE(y))); + if (a == 1) return DBL2NUM(1.0); + return DBL2NUM(pow((double)a, RFLOAT_VALUE(y))); default: return rb_num_coerce_bin(x, y, rb_intern("**")); } @@ -2854,7 +2854,7 @@ val = (double)FIX2LONG(num); - return DOUBLE2NUM(val); + return DBL2NUM(val); } /* @@ -3245,9 +3245,9 @@ rb_define_const(rb_cFloat, "MAX_EXP", INT2FIX(DBL_MAX_EXP)); rb_define_const(rb_cFloat, "MIN_10_EXP", INT2FIX(DBL_MIN_10_EXP)); rb_define_const(rb_cFloat, "MAX_10_EXP", INT2FIX(DBL_MAX_10_EXP)); - rb_define_const(rb_cFloat, "MIN", DOUBLE2NUM(DBL_MIN)); - rb_define_const(rb_cFloat, "MAX", DOUBLE2NUM(DBL_MAX)); - rb_define_const(rb_cFloat, "EPSILON", DOUBLE2NUM(DBL_EPSILON)); + rb_define_const(rb_cFloat, "MIN", DBL2NUM(DBL_MIN)); + rb_define_const(rb_cFloat, "MAX", DBL2NUM(DBL_MAX)); + rb_define_const(rb_cFloat, "EPSILON", DBL2NUM(DBL_EPSILON)); rb_define_method(rb_cFloat, "to_s", flo_to_s, 0); rb_define_method(rb_cFloat, "coerce", flo_coerce, 1); Index: bignum.c =================================================================== --- bignum.c (revision 19159) +++ bignum.c (revision 19160) @@ -1237,7 +1237,7 @@ static VALUE rb_big_to_f(VALUE x) { - return DOUBLE2NUM(rb_big2dbl(x)); + return DBL2NUM(rb_big2dbl(x)); } /* @@ -1499,7 +1499,7 @@ return bignorm(bigadd(x, y, 1)); case T_FLOAT: - return DOUBLE2NUM(rb_big2dbl(x) + RFLOAT_VALUE(y)); + return DBL2NUM(rb_big2dbl(x) + RFLOAT_VALUE(y)); default: return rb_num_coerce_bin(x, y, '+'); @@ -1524,7 +1524,7 @@ return bignorm(bigadd(x, y, 0)); case T_FLOAT: - return DOUBLE2NUM(rb_big2dbl(x) - RFLOAT_VALUE(y)); + return DBL2NUM(rb_big2dbl(x) - RFLOAT_VALUE(y)); default: return rb_num_coerce_bin(x, y, '-'); @@ -1588,7 +1588,7 @@ break; case T_FLOAT: - return DOUBLE2NUM(rb_big2dbl(x) * RFLOAT_VALUE(y)); + return DBL2NUM(rb_big2dbl(x) * RFLOAT_VALUE(y)); default: return rb_num_coerce_bin(x, y, '*'); @@ -1817,7 +1817,7 @@ { double div = rb_big2dbl(x) / RFLOAT_VALUE(y); if (op == '/') { - return DOUBLE2NUM(div); + return DBL2NUM(div); } else { return rb_dbl2big(div); @@ -2010,7 +2010,7 @@ if (ey) y = big_shift(y, ey); bignum: bigdivrem(x, y, &z, 0); - return DOUBLE2NUM(ldexp(big2dbl(z), ex - ey)); + return DBL2NUM(ldexp(big2dbl(z), ex - ey)); } case T_FLOAT: if (isnan(RFLOAT_VALUE(y))) return y; @@ -2035,7 +2035,7 @@ default: return rb_num_coerce_bin(x, y, rb_intern("fdiv")); } - return DOUBLE2NUM(dx / dy); + return DBL2NUM(dx / dy); } static VALUE @@ -2148,7 +2148,7 @@ default: return rb_num_coerce_bin(x, y, rb_intern("**")); } - return DOUBLE2NUM(pow(rb_big2dbl(x), d)); + return DBL2NUM(pow(rb_big2dbl(x), d)); } static VALUE Index: marshal.c =================================================================== --- marshal.c (revision 19159) +++ marshal.c (revision 19160) @@ -1306,7 +1306,7 @@ d = strtod(ptr, &e); d = load_mantissa(d, e, RSTRING_LEN(str) - (e - ptr)); } - v = DOUBLE2NUM(d); + v = DBL2NUM(d); v = r_entry(v, arg); v = r_leave(v, arg); } Index: random.c =================================================================== --- random.c (revision 19159) +++ random.c (revision 19160) @@ -505,7 +505,7 @@ limit = (struct RBignum *)rb_big_minus((VALUE)limit, INT2FIX(1)); if (FIXNUM_P((VALUE)limit)) { if (FIX2LONG((VALUE)limit) == -1) - return DOUBLE2NUM(genrand_real(mt)); + return DBL2NUM(genrand_real(mt)); return LONG2NUM(limited_rand(mt, FIX2LONG((VALUE)limit))); } return limited_big_rand(mt, limit); @@ -522,7 +522,7 @@ } if (max == 0) { - return DOUBLE2NUM(genrand_real(mt)); + return DBL2NUM(genrand_real(mt)); } if (max < 0) max = -max; val = limited_rand(mt, max-1); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/