From e149ee88cf53bb5665ab240a138be41d0b337ea8 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Fri, 25 May 2001 21:10:58 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'v1_6_4_preview4'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_6_4_preview4@1459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- numeric.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'numeric.c') diff --git a/numeric.c b/numeric.c index 0dd86f0532..40e607b222 100644 --- a/numeric.c +++ b/numeric.c @@ -332,7 +332,7 @@ flodivmod(x, y, divp, modp) double z; modf(x/y, &z); - mod = x - z * x; + mod = x - z * y; } #endif div = (x - mod) / y; @@ -1295,12 +1295,14 @@ static VALUE fix_aref(fix, idx) VALUE fix, idx; { - unsigned long val = FIX2LONG(fix); + long val = FIX2LONG(fix); int i = NUM2INT(idx); - if (i < 0 || sizeof(VALUE)*CHAR_BIT-1 < i) + if (i < 0 || sizeof(VALUE)*CHAR_BIT-1 < i) { + if (val < 0) return INT2FIX(1); return INT2FIX(0); - if (val & (1<