summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
author(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-05-25 21:10:58 +0000
committer(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-05-25 21:10:58 +0000
commite149ee88cf53bb5665ab240a138be41d0b337ea8 (patch)
tree6e0ff9f8c510431cf675ca9be2640d8761085b97 /numeric.c
parent99020d6e50702eb371111d73280eb80b4b29ba5b (diff)
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
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c10
1 files changed, 6 insertions, 4 deletions
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<<i))
+ }
+ if (val & (1L<<i))
return INT2FIX(1);
return INT2FIX(0);
}