* 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
Родитель dac421a9c9
Коммит d44ee210fa
2 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -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> Thu Sep 4 23:42:42 2008 Tanaka Akira <akr@fsij.org>
* include/ruby/intern.h (rb_file_open_str): declared. * include/ruby/intern.h (rb_file_open_str): declared.

Просмотреть файл

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