[前][次][番号順一覧][スレッド一覧]

ruby-changes:7617

From: mame <ko1@a...>
Date: Thu, 4 Sep 2008 23:50:26 +0900 (JST)
Subject: [ruby-changes:7617] Ruby:r19138 (trunk): * ext/bigdecimal/bigdecimal.c (BigDecimal_mode): set exception mode

mame	2008-09-04 23:47:40 +0900 (Thu, 04 Sep 2008)

  New Revision: 19138

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19138

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/ext/bigdecimal/bigdecimal.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19137)
+++ ChangeLog	(revision 19138)
@@ -1,3 +1,9 @@
+Thu Sep  4 23:47:05 2008  Yusuke Endoh  <mame@t...>
+
+	* 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@f...>
 
 	* include/ruby/intern.h (rb_file_open_str): declared.
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 19137)
+++ ext/bigdecimal/bigdecimal.c	(revision 19138)
@@ -412,11 +412,17 @@
             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) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]