[Groonga-commit] groonga/grnxx:8b571bf [master] Replace -0.0 with +0.0 in normalization.

Back to archive index

susumu.yata null+****@clear*****
Wed Apr 17 20:09:42 JST 2013


susumu.yata	2013-04-17 20:09:42 +0900 (Wed, 17 Apr 2013)

  New Revision: 8b571bf113403cb63fae062e256ce58e07a54b4b
  https://github.com/groonga/grnxx/commit/8b571bf113403cb63fae062e256ce58e07a54b4b

  Message:
    Replace -0.0 with +0.0 in normalization.

  Modified files:
    lib/grnxx/alpha/map/array.cpp
    lib/grnxx/alpha/map/double_array.cpp

  Modified: lib/grnxx/alpha/map/array.cpp (+6 -1)
===================================================================
--- lib/grnxx/alpha/map/array.cpp    2013-04-17 16:55:07 +0900 (f257f4b)
+++ lib/grnxx/alpha/map/array.cpp    2013-04-17 20:09:42 +0900 (e5b65d3)
@@ -34,7 +34,12 @@ struct Helper<T, true> {
     return (std::isnan(x) && std::isnan(y)) || (x == y);
   }
   static T normalize(T x) {
-    return std::isnan(x) ? std::numeric_limits<T>::quiet_NaN() : x;
+    if (std::isnan(x)) {
+      return std::numeric_limits<T>::quiet_NaN();
+    } else if (x == 0.0) {
+      return +0.0;
+    }
+    return x;
   }
 };
 

  Modified: lib/grnxx/alpha/map/double_array.cpp (+6 -1)
===================================================================
--- lib/grnxx/alpha/map/double_array.cpp    2013-04-17 16:55:07 +0900 (4a55284)
+++ lib/grnxx/alpha/map/double_array.cpp    2013-04-17 20:09:42 +0900 (3dd583b)
@@ -79,7 +79,12 @@ struct Helper<T, true> {
     return (std::isnan(x) && std::isnan(y)) || (x == y);
   }
   static T normalize(T x) {
-    return std::isnan(x) ? std::numeric_limits<T>::quiet_NaN() : x;
+    if (std::isnan(x)) {
+      return std::numeric_limits<T>::quiet_NaN();
+    } else if (x == 0.0) {
+      return +0.0;
+    }
+    return x;
   }
 };
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index