Kouhei Sutou
null+****@clear*****
Fri Oct 27 23:29:54 JST 2017
Kouhei Sutou 2017-10-27 23:29:54 +0900 (Fri, 27 Oct 2017) New Revision: 7918ecc92f6603362277c31144281f3746ae3f93 https://github.com/groonga/groonga/commit/7918ecc92f6603362277c31144281f3746ae3f93 Message: Use epsilon to compare double Modified files: lib/operator.c Modified: lib/operator.c (+3 -1) =================================================================== --- lib/operator.c 2017-10-27 15:31:50 +0900 (bece43883) +++ lib/operator.c 2017-10-27 23:29:54 +0900 (44da293cb) @@ -22,6 +22,8 @@ #include "grn_normalizer.h" #include <string.h> +#include <math.h> +#include <float.h> #ifdef GRN_WITH_ONIGMO # define GRN_SUPPORT_REGEXP @@ -195,7 +197,7 @@ grn_operator_to_exec_func(grn_operator op) r = (x_ == GRN_UINT64_VALUE(y));\ break;\ case GRN_DB_FLOAT :\ - r = ((x_ <= GRN_FLOAT_VALUE(y)) && (x_ >= GRN_FLOAT_VALUE(y)));\ + r = (fabs(x_ - GRN_FLOAT_VALUE(y)) < DBL_EPSILON);\ break;\ case GRN_DB_SHORT_TEXT :\ case GRN_DB_TEXT :\ -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20171027/662659b0/attachment-0001.htm