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
10b626b3
Unverified
Commit
10b626b3
authored
Apr 02, 2020
by
Salvatore Sanfilippo
Committed by
GitHub
Apr 02, 2020
Browse files
Merge pull request #6546 from guybe7/fix_neg_zero
Make sure Redis does not reply with negative zero
parents
2f53ad30
8beec4f0
Changes
2
Show whitespace changes
Inline
Side-by-side
src/util.c
View file @
10b626b3
...
@@ -602,6 +602,10 @@ int ld2string(char *buf, size_t len, long double value, ld2string_mode mode) {
...
@@ -602,6 +602,10 @@ int ld2string(char *buf, size_t len, long double value, ld2string_mode mode) {
}
}
if
(
*
p
==
'.'
)
l
--
;
if
(
*
p
==
'.'
)
l
--
;
}
}
if
(
l
==
2
&&
buf
[
0
]
==
'-'
&&
buf
[
1
]
==
'0'
)
{
buf
[
0
]
=
'0'
;
l
=
1
;
}
break
;
break
;
default:
return
0
;
/* Invalid mode. */
default:
return
0
;
/* Invalid mode. */
}
}
...
...
tests/unit/type/incr.tcl
View file @
10b626b3
...
@@ -151,4 +151,10 @@ start_server {tags {"incr"}} {
...
@@ -151,4 +151,10 @@ start_server {tags {"incr"}} {
catch
{
r incrbyfloat foo 1
}
err
catch
{
r incrbyfloat foo 1
}
err
format $err
format $err
}
{
ERR*valid*
}
}
{
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