[#38563] [Bug #1556] irb does not save history from 1.8.7-p83 and later — Nobuhiro IMAI <redmine@...>
Bug #1556: irb does not save history from 1.8.7-p83 and later
けいじゅ@いしつかです.
まつもと ゆきひろです
いまいです。
けいじゅ@いしつかです.
[#38571] [Bug #1582] IO.new Raises Other Errors between 1.8 and 1.9 — "ujihisa ." <redmine@...>
Bug #1582: IO.new Raises Other Errors between 1.8 and 1.9
チケット #1582 が更新されました。 (by Motohiro KOSAKI)
なかだです。
2010年2月27日9:43 Nobuyoshi Nakada <nobu@ruby-lang.org>:
[#38602] [Feature: trunk] rb_objspace_each_objects — SASADA Koichi <ko1@...>
ささだです.
まつもと ゆきひろです
ささだです.
ささだです.
まつもと ゆきひろです
[#38607] [Feature: trunk] GC.stat — SASADA Koichi <ko1@...>
ささだです.
In article <4A349F64.5000702@atdot.net>,
ささだです.
In article <4A3612EF.1080008@atdot.net>,
ささだです。
まつもと ゆきひろです
ささだです。
2010年10月15日16:32 SASADA Koichi <ko1@atdot.net>:
[#38608] Fixnum#fdiv — Tadayoshi Funaba <tadf@...>
Bignum#fdiv には大きな数である場合の配慮があるようですが、Fixnum ではな
fdiv では2つの異る解釈が混在しているように見えます。
まつもと ゆきひろです
> えーと、設計者は「fdivは結果がfloatになるdiv」くらいしか考え
まつもと ゆきひろです
> ふむ。「中途半端」というのはfixnumとbignumで食い違うと言う意
> > ふむ。「中途半端」というのはfixnumとbignumで食い違うと言う意
まつもと ゆきひろです
> 私が気にしているのは「挙動の理解しやすさ」ですね。
まつもと ゆきひろです
> 繰り返しになりますが、「より正確な除算」とかだと独立した実装
まつもと ゆきひろです
この件を修正しようとしていますが、
[#38609] [Feature: trunk] *_memsize() — SASADA Koichi <ko1@...>
ささだです.
[#38613] [BUG: trunk] called on terminated object — SASADA Koichi <ko1@...>
ささだです.
[#38695] [feature:trunk] let irb use pretty_inspect if possible — Yusuke ENDOH <mame@...>
遠藤です。
けいじゅ@いしつかです.
遠藤です。
けいじゅ@いしつかです.
[#38698] [Bug #1674] set_trace_func with 1line block — _ wanabe <redmine@...>
Bug #1674: set_trace_func with 1line block
[#38701] [Bug #1676] only last "return" is traced by set_trace_func — _ wanabe <redmine@...>
Bug #1676: only last "return" is traced by set_trace_func
[ruby-dev:38637] Re: Fixnum#fdiv
後者の考えに基いて修正してみました。
Inf.fdiv(Float::MAX.to_i*2)
などの場合も対処しないといけないと思いますが、とりあえず。
Index: complex.c
===================================================================
--- complex.c (revision 23694)
+++ complex.c (working copy)
@@ -660,6 +660,7 @@
static VALUE
nucomp_fdiv(VALUE self, VALUE other)
{
+ rb_warning("Complex#fdiv will be deprecated in the future");
return nucomp_divide(self, other, f_fdiv, id_fdiv);
}
Index: bignum.c
===================================================================
--- bignum.c (revision 23694)
+++ bignum.c (working copy)
@@ -2382,6 +2382,53 @@
return x;
}
+static VALUE
+big_fdiv(VALUE x, VALUE y)
+{
+#define DBL_BIGDIG ((DBL_MANT_DIG + BITSPERDIG) / BITSPERDIG)
+ VALUE z;
+ long l, ex, ey;
+ int i;
+
+ bigtrunc(x);
+ l = RBIGNUM_LEN(x) - 1;
+ ex = l * BITSPERDIG;
+ ex += bdigbitsize(BDIGITS(x)[l]);
+ ex -= 2 * DBL_BIGDIG * BITSPERDIG;
+ if (ex) x = big_shift(x, ex);
+
+ switch (TYPE(y)) {
+ case T_FIXNUM:
+ y = rb_int2big(FIX2LONG(y));
+ case T_BIGNUM: {
+ bigtrunc(y);
+ l = RBIGNUM_LEN(y) - 1;
+ ey = l * BITSPERDIG;
+ ey += bdigbitsize(BDIGITS(y)[l]);
+ ey -= DBL_BIGDIG * BITSPERDIG;
+ if (ey) y = big_shift(y, ey);
+ bignum:
+ bigdivrem(x, y, &z, 0);
+ l = ex - ey;
+#if SIZEOF_LONG > SIZEOF_INT
+ {
+ /* Visual C++ can't be here */
+ if (l > INT_MAX) return DBL2NUM(ruby_div0(1.0));
+ if (l < INT_MIN) return DBL2NUM(0.0);
+ }
+#endif
+ return DBL2NUM(ldexp(big2dbl(z), (int)l));
+ }
+ case T_FLOAT:
+ y = dbl2big(ldexp(frexp(RFLOAT_VALUE(y), &i), DBL_MANT_DIG));
+ ey = i - DBL_MANT_DIG;
+ goto bignum;
+ }
+ /* NOTREACHED */
+ abort();
+ return Qnil;
+}
+
/*
* call-seq:
* big.fdiv(numeric) -> float
@@ -2394,65 +2441,32 @@
*
*/
-static VALUE
+
+VALUE
rb_big_fdiv(VALUE x, VALUE y)
{
- double dx = big2dbl(x);
- double dy;
+ double dx, dy;
- if (isinf(dx)) {
-#define DBL_BIGDIG ((DBL_MANT_DIG + BITSPERDIG) / BITSPERDIG)
- VALUE z;
- long l, ex, ey;
- int i;
-
- bigtrunc(x);
- l = RBIGNUM_LEN(x) - 1;
- ex = l * BITSPERDIG;
- ex += bdigbitsize(BDIGITS(x)[l]);
- ex -= 2 * DBL_BIGDIG * BITSPERDIG;
- if (ex) x = big_shift(x, ex);
-
- switch (TYPE(y)) {
- case T_FIXNUM:
- y = rb_int2big(FIX2LONG(y));
- case T_BIGNUM: {
- bigtrunc(y);
- l = RBIGNUM_LEN(y) - 1;
- ey = l * BITSPERDIG;
- ey += bdigbitsize(BDIGITS(y)[l]);
- ey -= DBL_BIGDIG * BITSPERDIG;
- if (ey) y = big_shift(y, ey);
- bignum:
- bigdivrem(x, y, &z, 0);
- l = ex - ey;
-#if SIZEOF_LONG > SIZEOF_INT
- {
- /* Visual C++ can't be here */
- if (l > INT_MAX) return DBL2NUM(ruby_div0(1.0));
- if (l < INT_MIN) return DBL2NUM(0.0);
- }
-#endif
- return DBL2NUM(ldexp(big2dbl(z), (int)l));
- }
- case T_FLOAT:
- if (isnan(RFLOAT_VALUE(y))) return y;
- y = dbl2big(ldexp(frexp(RFLOAT_VALUE(y), &i), DBL_MANT_DIG));
- ey = i - DBL_MANT_DIG;
- goto bignum;
- }
- }
+ dx = big2dbl(x);
switch (TYPE(y)) {
case T_FIXNUM:
dy = (double)FIX2LONG(y);
+ if (isinf(dx))
+ return big_fdiv(x, y);
break;
case T_BIGNUM:
dy = rb_big2dbl(y);
+ if (isinf(dx) || isinf(dy))
+ return big_fdiv(x, y);
break;
case T_FLOAT:
dy = RFLOAT_VALUE(y);
+ if (isnan(dy))
+ return y;
+ if (isinf(dx))
+ return big_fdiv(x, y);
break;
default:
Index: rational.c
===================================================================
--- rational.c (revision 23694)
+++ rational.c (working copy)
@@ -769,7 +769,7 @@
static VALUE
nurat_fdiv(VALUE self, VALUE other)
{
- return f_div(f_to_f(self), other);
+ return f_to_f(f_div(self, other));
}
static VALUE