[ruby-oci8-commit] [494] trunk/ruby-oci8: Use isnan() and isinf() instead of fpclassify() for platforms which don't have fpclassify().

nobody at rubyforge.org nobody at rubyforge.org
Sun Jan 22 09:34:17 EST 2012


Revision: 494
Author:   kubo
Date:     2012-01-22 09:34:17 -0500 (Sun, 22 Jan 2012)

Log Message:
-----------
Use isnan() and isinf() instead of fpclassify() for platforms which don't have fpclassify().

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/ocinumber.c

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2012-01-19 14:15:36 UTC (rev 493)
+++ trunk/ruby-oci8/ChangeLog	2012-01-22 14:34:17 UTC (rev 494)
@@ -1,3 +1,8 @@
+2012-01-22  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/ocinumber.c: Use isnan() and isinf() instead of fpclassify()
+	    for platforms which don't have fpclassify().
+	    (reported by John Beckwith)
+
 2012-01-19  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/extconf.rb, pre-distclean.rb, ruby-oci8.gemspec: create map files
 	    of oci8lib_*.so on mingw32 in case of analyzing a core (minidump) file.

Modified: trunk/ruby-oci8/ext/oci8/ocinumber.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/ocinumber.c	2012-01-19 14:15:36 UTC (rev 493)
+++ trunk/ruby-oci8/ext/oci8/ocinumber.c	2012-01-22 14:34:17 UTC (rev 494)
@@ -332,12 +332,10 @@
 
 OCINumber *oci8_dbl_to_onum(OCINumber *result, double dbl, OCIError *errhp)
 {
-    switch (fpclassify(dbl)) {
-    case FP_NAN:
+    if (isnan(dbl)) {
         rb_raise(rb_eFloatDomainError, "NaN");
         /* never reach here */
-        break;
-    case FP_INFINITE:
+    } else if (isinf(dbl)) {
         if (dbl > 0.0) {
             oranumber_from_str(result, "~", 1);
         } else {




More information about the ruby-oci8-commit mailing list