Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
7764996b
Commit
7764996b
authored
Nov 05, 2019
by
Guy Benoish
Committed by
antirez
Apr 07, 2020
Browse files
Make sure Redis does not reply with negative zero
parent
eba28e2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/util.c
View file @
7764996b
...
...
@@ -602,6 +602,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. */
}
...
...
tests/unit/type/incr.tcl
View file @
7764996b
...
...
@@ -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
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment