[Groonga-commit] groonga/groonga-query-log at 832f19a [master] Stop to use "==" for comparing floating point number

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Apr 27 17:03:20 JST 2017


Kouhei Sutou	2017-04-27 17:03:20 +0900 (Thu, 27 Apr 2017)

  New Revision: 832f19a1c89ed9802e18b3c791e7fe92e2e29179
  https://github.com/groonga/groonga-query-log/commit/832f19a1c89ed9802e18b3c791e7fe92e2e29179

  Message:
    Stop to use "==" for comparing floating point number

  Modified files:
    lib/groonga/query-log/response-comparer.rb

  Modified: lib/groonga/query-log/response-comparer.rb (+3 -1)
===================================================================
--- lib/groonga/query-log/response-comparer.rb    2017-04-24 15:44:34 +0900 (209c66c)
+++ lib/groonga/query-log/response-comparer.rb    2017-04-27 17:03:20 +0900 (4682c23)
@@ -74,7 +74,9 @@ module Groonga
       end
 
       def same_cache_hit_rate?
-        @response1.body["cache_hit_rate"] ==****@respo*****["cache_hit_rate"]
+        cache_hit_rate1 =****@respo*****["cache_hit_rate"]
+        cache_hit_rate2 =****@respo*****["cache_hit_rate"]
+        (cache_hit_rate1 - cache_hit_rate2).abs <= (Float::EPSILON * 10)
       end
 
       def care_order?
-------------- next part --------------
HTML����������������������������...
Download 



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