New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lua LDB debugging: Float precision is lost in stack values and [p]rint of Lua vars #4688
Comments
@itamarhaber : Some more people on our team are starting to use redis' ldb (with or without ZeroBraneStudio). We'd greatly appreciate some feedback on this issue. |
I think this is a good suggestion, and it shouldn't break anything major as this is ldb after all. Pong @antirez ? |
Hello @tw-bert, @itamarhaber, what conversion function is that in LDB? I've no idea about what ZeroBrane does so with the informations in this issue I'm not sure what the problem is, a set of commands directly send to the Redis LDB showing the issue would be appreciated. Thanks. |
@antirez @itamarhaber Here's a repro: tw_bert@srv-flux-dev-01:~$ printf 'local f=20180713.143205\nreturn tostring(f)' > test.lua
tw_bert@srv-flux-dev-01:~$ redis-cli -p 14213 --ldb --eval test.lua
Lua debugging session started, please use:
quit -- End the session.
restart -- Restart the script in debug mode again.
help -- Show Lua script debugging commands.
* Stopped at 1, stop reason = step over
-> 1 local f=20180713.143205
lua debugger> s
* Stopped at 2, stop reason = step over
-> 2 return tostring(f)
lua debugger> p
<value> f = 2.01807e+07
lua debugger> s
"20180713.143205"
(Lua debugging session ended -- dataset changes rolled back) The issue is, that |
Redis
4.0.8
Follow up on: pkulchenko/ZeroBranePackage#66
Redis docs: https://redis.io/topics/ldb
In short:
20180212.1045
is serialized as2.01802e+07
which is unusable (because: it's a timestamp:YYYYMMDD.HHMM
). The non mantissa precision of 53 bit (15 digits in base-10) should not be lost in the serialization. In this example the precision goes down from 12 digits to 6 digits.Possible solution: Use format
"%015.15g"
and/or let the user set a custom session-persistent float serialization string.The text was updated successfully, but these errors were encountered: