1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/bigdecimal/bigdecimal.c (BigDecimal_mode): set exception mode

correctly.  In spite of BigDecimal.mode(BigDecimal::EXCEPTION_ALL,
  true), BigDecimal.new("NaN") did not raise an exception previously.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2008-09-04 14:47:40 +00:00
parent dac421a9c9
commit d44ee210fa
2 changed files with 12 additions and 0 deletions

View file

@ -1,3 +1,9 @@
Thu Sep 4 23:47:05 2008 Yusuke Endoh <mame@tsg.ne.jp>
* ext/bigdecimal/bigdecimal.c (BigDecimal_mode): set exception mode
correctly. In spite of BigDecimal.mode(BigDecimal::EXCEPTION_ALL,
true), BigDecimal.new("NaN") did not raise an exception previously.
Thu Sep 4 23:42:42 2008 Tanaka Akira <akr@fsij.org>
* include/ruby/intern.h (rb_file_open_str): declared.

View file

@ -412,11 +412,17 @@ BigDecimal_mode(int argc, VALUE *argv, VALUE self)
VpSetException((unsigned short)((val==Qtrue)?(fo|VP_EXCEPTION_INFINITY):
(fo&(~VP_EXCEPTION_INFINITY))));
}
fo = VpGetException();
if(f&VP_EXCEPTION_NaN) {
VpSetException((unsigned short)((val==Qtrue)?(fo|VP_EXCEPTION_NaN):
(fo&(~VP_EXCEPTION_NaN))));
}
fo = VpGetException();
if(f&VP_EXCEPTION_UNDERFLOW) {
VpSetException((unsigned short)((val==Qtrue)?(fo|VP_EXCEPTION_UNDERFLOW):
(fo&(~VP_EXCEPTION_UNDERFLOW))));
}
fo = VpGetException();
return INT2FIX(fo);
}
if(VP_ROUND_MODE==f) {