mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
Make sure Redis does not reply with negative zero
This commit is contained in:
parent
a15a5d7097
commit
8beec4f0e7
@ -560,6 +560,10 @@ int ld2string(char *buf, size_t len, long double value, ld2string_mode mode) {
|
||||
}
|
||||
if (*p == '.') l--;
|
||||
}
|
||||
if (l == 2 && buf[0] == '-' && buf[1] == '0') {
|
||||
buf[0] = '0';
|
||||
l = 1;
|
||||
}
|
||||
break;
|
||||
default: return 0; /* Invalid mode. */
|
||||
}
|
||||
|
@ -151,4 +151,10 @@ start_server {tags {"incr"}} {
|
||||
catch {r incrbyfloat foo 1} err
|
||||
format $err
|
||||
} {ERR*valid*}
|
||||
|
||||
test {No negative zero} {
|
||||
r incrbyfloat foo [expr double(1)/41]
|
||||
r incrbyfloat foo [expr double(-1)/41]
|
||||
r get foo
|
||||
} {0}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user