FFFF JSON.NUMINCRBY / JSON.NUMMULTBY turn a whole float result into an integer · Issue #470 · kividbio/kividb · GitHub
[go: up one dir, main page]

Skip to content

JSON.NUMINCRBY / JSON.NUMMULTBY turn a whole float result into an integer #470

Open

Description

@murtazayusuf

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

  1. added
    bugSomething isn't working
    redis-compatA test in Redis's own test suite fails against KiviDB
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingredis-compatA test in Redis's own test suite fails against KiviDB

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0