Open catwell opened 10 years ago
You use tostring to convert numbers to the Redis protocol format. This does not work correctly with integers above 10^14:
10^14
> =tostring(10^14-1) 99999999999999 > =tostring(10^14) 1e+14
It is possible to support numbers up to about 2^53, i.e. about 9*10^15, by using string.format instead:
2^53
9*10^15
string.format
> =string.format("%d",10^14) 100000000000000
Everything above 2^53-1 or below 2^53+1 is dangerous anyway, because you start seeing this:
2^53-1
2^53+1
> x = 2^53 > =(x == x+1) true
Not sure how the client should handle this.
(related: https://github.com/catwell/fakeredis/commit/a076588b87f24b1f5982c01e3265074a81b95db0#diff-cb226e1732729d7a5e8f0508ee7de92eR127)
You use tostring to convert numbers to the Redis protocol format. This does not work correctly with integers above
10^14
:It is possible to support numbers up to about
2^53
, i.e. about9*10^15
, by usingstring.format
instead:Everything above
2^53-1
or below2^53+1
is dangerous anyway, because you start seeing this:Not sure how the client should handle this.