You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JSON.NUMINCRBY / JSON.NUMMULTBY turn a whole float result into an integer #470
arithmetic() in src/commands/json.rs (around lines 362-366) stores any result with fract() == 0.0 and |x| < 2^53 as an integer. Some examples:
JSON.SET k $ 1.0 then JSON.NUMINCRBY k $ 0 stores 1.
1.5 + 1.5 stores 3.
1e5 + 0 stores 100000.
-0.0 * 1 stores 0, losing the sign.
Afterwards, JSON.TYPE says integer instead of number, and JSON.GET shows 1 instead of 1.0. Whole results of 2^53 and above stay floats, so the rule isn't even consistent.
Expected (RedisJSON): a float stays a float (1.0, 100000.0). The result is an integer only when both operands are integers. -0 + 0 gives 0.0.
Found while reviewing #463 (#445). RedisJSON's replies come from a byte-for-byte probe against Redis 8.10.3.
Activity