Groups
Groups
Sign in
Groups
Groups
Lua Chinese(Lua中文用户组)
Conversations
About
Send feedback
Help
lua大整数运算精度问题
16 views
Skip to first unread message
姚尉
unread,
Aug 22, 2015, 10:53:10 AM
8/22/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Lua Chinese(Lua中文用户组)
hi,all
最近用lua处理某些大整数的时候发现不对劲
下面这条语句的结果是:
10992432728506384
print(string.format("%d", 186312419127226*59 + 49))
但是这个算术得到的结果应该是:
10992432728506383
有人碰到过同样的问题吗?
不知道是因为string.format的问题呢,
还是说lua本身计算的时候精度导致的,这个结果没有超过long型啊
而且逢9的算术好像都有问题比如:186312419127226*59 + 39
luajit也有同样的问题
lua 版本:5.1.5
luajit版本:2.1.0-alpha
64位操作系统
Reply all
Reply to author
Forward
0 new messages