* 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
@ -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>
|
Wed Nov 26 23:15:47 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* strftime.c (STRFTIME): use rb_strftime() recursively, instead of
|
* strftime.c (STRFTIME): use rb_strftime() recursively, instead of
|
||||||
|
@ -1169,7 +1169,10 @@ BigDecimal_div2(int argc, VALUE *argv, VALUE self)
|
|||||||
Real *mod;
|
Real *mod;
|
||||||
obj = BigDecimal_DoDivmod(self,b,&div,&mod);
|
obj = BigDecimal_DoDivmod(self,b,&div,&mod);
|
||||||
if(obj!=(VALUE)0) return obj;
|
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 */
|
} else { /* div in BigDecimal sense */
|
||||||
U_LONG ix = (U_LONG)GetPositiveInt(n);
|
U_LONG ix = (U_LONG)GetPositiveInt(n);
|
||||||
if(ix==0) return BigDecimal_div(self,b);
|
if(ix==0) return BigDecimal_div(self,b);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user