fix: preserve numerical precision on unary negation (#3242)

This commit is contained in:
itchyny authored and GitHub committed 2025-02-06 07:50:21 +09:00
1 parent 972772153f
commit 6ce3bdf382
7 files changed
+55 -22

No files matched your search

+1 -1
View File
@@ -256,7 +256,7 @@ static jv f_negate(jq_state *jq, jv input) {
if (jv_get_kind(input) != JV_KIND_NUMBER) {
return type_error(input, "cannot be negated");
}
jv ret = jv_number(-jv_number_value(input));
jv ret = jv_number_negate(input);
jv_free(input);
return ret;
}