Skip to content

Commit

Permalink
fix(write):correct write value verification
Browse files Browse the repository at this point in the history
  • Loading branch information
hxy7yx committed Nov 1, 2024
1 parent fa91290 commit 57dd824
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/adapter/driver/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,8 @@ int check_value_decimal(neu_type_e write_type, double result, int64_t value_min,
return NEU_ERR_PLUGIN_TAG_TYPE_MISMATCH;
} else if (result < value_min || result > value_max) {
return NEU_ERR_PLUGIN_TAG_VALUE_OUT_OF_RANGE;
} else if (almost_equal(ceil(result), result, EPSILON)) {
} else if (almost_equal(ceil(result), result, EPSILON) ||
almost_equal(floor(result), result, EPSILON)) {
return NEU_ERR_SUCCESS;
} else {
return NEU_ERR_PLUGIN_TAG_TYPE_MISMATCH;
Expand Down Expand Up @@ -977,7 +978,8 @@ int is_value_in_range(neu_type_e tag_type, int64_t value, double value_d,
case NEU_TYPE_UINT64:
if (write_type != NEU_TYPE_INT64 && write_type != NEU_TYPE_DOUBLE) {
return NEU_ERR_PLUGIN_TAG_TYPE_MISMATCH;
} else if (almost_equal(ceil(result), result, EPSILON)) {
} else if (almost_equal(ceil(result), result, EPSILON) ||
almost_equal(floor(result), result, EPSILON)) {
return NEU_ERR_SUCCESS;
} else {
return NEU_ERR_PLUGIN_TAG_TYPE_MISMATCH;
Expand Down

0 comments on commit 57dd824

Please sign in to comment.