各位大哥excel这个公式错误原因是什么???看不懂啊

inei2333-avatar

inei2333

编辑了,确实拙劣
fire the wyvern-avatar

fire the wyvern

查一下前面三个数的数据类型和显示样式
GoldenTurdle-avatar

GoldenTurdle

小数点
建议加round
GoldenTurdle-avatar

GoldenTurdle

[quote][pid=500376683,25918851,1]Reply[/pid] Post by [uid=17476971]铭之与海[/uid] (2021-03-15 14:42):
以我拙劣的excel水平,24后面是不是还有个括号[/quote]不用括号,他就这一个条件
Menkaura-avatar

Menkaura

但这个就小数点后两位数,也没有看出来哪里有问题啊
Yadig_tina🌮-avatar

Yadig_tina🌮

看看AB两列的数字是精确值,还是四舍五入后的。
Candy_Man_That_Can-avatar

Candy_Man_That_Can

以显示精度为准?
NightraGaming-avatar

NightraGaming

建议输出A-B到另一列,可能是精确性问题
kalechips-avatar

kalechips

我自己试了一下,6661.21-6632.65
不知道为啥excel算出来就是28.56000000004
公式里加个round就好了
Menkaura-avatar

Menkaura

[quote][pid=500377051,25918851,1]Reply[/pid] Post by [uid=60354075]小雅冰[/uid] (2021-03-15 14:43):

看看AB两列的数字是精确值,还是四舍五入后的。[/quote]都是精确值
FakeGumball-avatar

FakeGumball

鼠标分别放到a,b,c,看看实际数是多少
GoldenTurdle-avatar

GoldenTurdle

应该是位数精度的问题
我做了个判断,也是flase
[img]https://img.nga.178.com/attachments/mon_202103/15/-7Q16s-9rr3XuZ8cT3cS340-1eg.jpeg[/img]然后加个个round,就是ture,所以加round吧楼主
413hertz🐋-avatar

413hertz🐋

我觉得是前面两个数不是精确的小数点后两位数,我测试了楼上的减法,明确没有00004
알렉시스-avatar

알렉시스

上面已经说了吧,加round

原生js 0.1+0.2也有问题
inei2333-avatar

inei2333

[quote][pid=500377974,25918851,1]Reply[/pid] Post by [uid=630462]aidefeixv[/uid] (2021-03-15 14:47):

应该是位数精度的问题
我做了个判断,也是flase
[img]https://img.nga.178.com/attachments/mon_202103/15/-7Q16s-9rr3XuZ8cT3cS340-1eg.jpeg[/img]然后加个个round,就是ture,所以加round吧楼主[/quote][img]https://img.nga.178.com/attachments/mon_202103/15/-7Q16s-l6vlXkZ5oT3cSzk-qo.jpg.medium.jpg[/img]

也不对诶
알렉시스-avatar

알렉시스

Reply to [pid=500377553,25918851,1]Reply[/pid] Post by [uid=557398]osiris_0o0[/uid] (2021-03-15 14:45)

10进制中是“整的”,但是2进制中并不一定是
Jonny-avatar

Jonny

c语言第一课:不要判断浮点数相等。
解决办法:如果确认小数点后最多两位(例如金额),乘以100并取整,然后判断。否则把a=b改为abs(a-b)<eps
kaza-avatar

kaza

貌似是真的也。为什么会前后不等呢……
Menkaura-avatar

Menkaura

哪位大哥帮忙写一个正确的公式