diff --git a/ChangeLog b/ChangeLog index 87e48a48e3..612f2f7e78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Sep 4 23:47:05 2008 Yusuke Endoh + + * 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 * include/ruby/intern.h (rb_file_open_str): declared. diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index e8da7cc415..754c319991 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -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) {