Comment From: sundb
0 is neither a positive nor a negative number... So it doesn't have a negative sign.
Comment From: lijinliangyihao
@sundb But it isn't an error, and should be treated as 0.
My lua script crashed because of this.
In any programming language, expression int a = -0 is considered legal.
Comment From: sundb
@lijinliangyihao You're right, also I found that HINCRBYFLOAT -0 is legal.
Do you wanna make a PR to fix it?
Comment From: enjoy-binbin
Does this mean we need to support +0 or -0000 or +1 ... ? these are all legal in Python
if we just want to support -0, we can simply modify string2ll to support it
Comment From: sundb
@enjoy-binbin I think -0 is enough, in some scenarios we might add - sign in front of a positive number to make it negative, but not a + sign in front of a negative number.
Comment From: enjoy-binbin
noted that HINCRBYFLOAT is support +0 and -0 and +00000 and -0000000, and even -00001, +00001. it using string2ld and support these
Comment From: lijinliangyihao
It seems fix this problem is not very helpful, and may cause other problems. This error can be bypassed by not using -0. Users should be more careful when using script:
local num = tonumber(ARGV[1])
redis.call('incrby', KEYS[1], -num)
they should make sure num is not zero.