mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/bigdecimal/bigdecimal.c (BigDecimal_round): should be round
to integer. [ruby-dev:37355] * ext/bigdecimal/bigdecimal.c (BigDecimal_divmod): division should be integer. [incompatible] [ruby-dev:37355] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bd4d9e9a35
commit
82c719c337
2 changed files with 13 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
|||
Thu Dec 11 01:48:00 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* ext/bigdecimal/bigdecimal.c (BigDecimal_round): should be round
|
||||
to integer. [ruby-dev:37355]
|
||||
|
||||
* ext/bigdecimal/bigdecimal.c (BigDecimal_divmod): division should
|
||||
be integer. [incompatible] [ruby-dev:37355]
|
||||
|
||||
Thu Dec 11 01:21:58 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* thread.c (rb_mutex_unlock): shut up warning. a patch from
|
||||
|
|
|
@ -1155,7 +1155,7 @@ BigDecimal_divmod(VALUE self, VALUE r)
|
|||
obj = BigDecimal_DoDivmod(self,r,&div,&mod);
|
||||
if(obj!=(VALUE)0) return obj;
|
||||
SAVE(div);SAVE(mod);
|
||||
obj = rb_assoc_new(ToValue(div), ToValue(mod));
|
||||
obj = rb_assoc_new(BigDecimal_to_i(ToValue(div)), ToValue(mod));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -1369,6 +1369,9 @@ BigDecimal_round(int argc, VALUE *argv, VALUE self)
|
|||
GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
|
||||
VpSetPrecLimit(pl);
|
||||
VpActiveRound(c,a,sw,iLoc);
|
||||
if (argc == 0) {
|
||||
return BigDecimal_to_i(ToValue(c));
|
||||
}
|
||||
return ToValue(c);
|
||||
}
|
||||
|
||||
|
@ -1983,7 +1986,7 @@ Init_bigdecimal(void)
|
|||
rb_define_method(rb_cBigDecimal, "add", BigDecimal_add2, 2);
|
||||
rb_define_method(rb_cBigDecimal, "sub", BigDecimal_sub2, 2);
|
||||
rb_define_method(rb_cBigDecimal, "mult", BigDecimal_mult2, 2);
|
||||
rb_define_method(rb_cBigDecimal, "div",BigDecimal_div2, -1);
|
||||
rb_define_method(rb_cBigDecimal, "div", BigDecimal_div2, -1);
|
||||
rb_define_method(rb_cBigDecimal, "hash", BigDecimal_hash, 0);
|
||||
rb_define_method(rb_cBigDecimal, "to_s", BigDecimal_to_s, -1);
|
||||
rb_define_method(rb_cBigDecimal, "to_i", BigDecimal_to_i, 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue