mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/bigdecimal/bigdecimal.c (BigDecimal_div2): should return
Integer for #div operation. * ext/bigdecimal/bigdecimal.c (BigDecimal_div2): should raise ZeroDivisionError if divisor is zero. [ruby-dev:37207] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b0f3bd5d25
commit
5337b9b5f6
2 changed files with 12 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
Thu Nov 27 10:40:52 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* ext/bigdecimal/bigdecimal.c (BigDecimal_div2): should return
|
||||
Integer for #div operation.
|
||||
|
||||
* ext/bigdecimal/bigdecimal.c (BigDecimal_div2): should raise
|
||||
ZeroDivisionError if divisor is zero. [ruby-dev:37207]
|
||||
|
||||
Wed Nov 26 23:15:47 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* strftime.c (STRFTIME): use rb_strftime() recursively, instead of
|
||||
|
|
|
@ -1169,7 +1169,10 @@ BigDecimal_div2(int argc, VALUE *argv, VALUE self)
|
|||
Real *mod;
|
||||
obj = BigDecimal_DoDivmod(self,b,&div,&mod);
|
||||
if(obj!=(VALUE)0) return obj;
|
||||
return ToValue(div);
|
||||
if(VpIsNaN(div) && rb_equal(b, INT2FIX(0))) {
|
||||
rb_raise(rb_eZeroDivError, "divided by 0");
|
||||
}
|
||||
return BigDecimal_to_i(ToValue(div));
|
||||
} else { /* div in BigDecimal sense */
|
||||
U_LONG ix = (U_LONG)GetPositiveInt(n);
|
||||
if(ix==0) return BigDecimal_div(self,b);
|
||||
|
|
Loading…
Add table
Reference in a new issue