Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

lua - How to precise calculate prices on Redis

127.0.0.1:6379> set a 10000000
OK
127.0.0.1:6379> eval 'return tostring(redis.call("get", "a") + 1.0000008)' 0
"10000001.000001"

I have to do other operations besides addition.

I found that Lua's Number supports up to 14 digits, It is no longer accurate after more than 14. While this scope is sufficient for my current needs, my scalability is limited by this.

Is there any workaround?

question from:https://stackoverflow.com/questions/65930441/how-to-precise-calculate-prices-on-redis

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...