救命!数字没有正确添加 [英] Help! Numbers not adding properly

查看:79
本文介绍了救命!数字没有正确添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在添加两个数字时遇到问题。我想添加1.005和

1.007以获得2.012。应该够轻松吧?问题是

我一直得到2.0119999999999996作为我的结果。为什么会这样?

有没有办法可以让它返回正确的结果?任何帮助都是

赞赏。


谢谢,

David J. Ricker II

I am having problems adding two numbers. I am trying to add 1.005 and
1.007 to come up with 2.012. Should be easy enough right? Problem is that
I keep getting 2.0119999999999996 as my result. Why is this happening? Is
there a way that I can get it to return the right result? Any help is
appreciated.

Thanks,
David J. Ricker II

推荐答案

您使用的数据类型是什么?


David Ricker <哒************* @ hotmail.com>在消息中写道

新闻:eW ************** @ TK2MSFTNGP12.phx.gbl ...
What data types are you using?

"David Ricker" <da*************@hotmail.com> wrote in message
news:eW**************@TK2MSFTNGP12.phx.gbl...
我在添加时遇到问题两个数字。我想添加1.005和
1.007来提出2.012。应该够轻松吧?问题是
,我一直得到2.0119999999999996作为我的结果。为什么会这样?
有没有办法可以让它返回正确的结果?任何帮助都表示赞赏。

谢谢,
David J. Ricker II
I am having problems adding two numbers. I am trying to add 1.005 and
1.007 to come up with 2.012. Should be easy enough right? Problem is that I keep getting 2.0119999999999996 as my result. Why is this happening? Is there a way that I can get it to return the right result? Any help is
appreciated.

Thanks,
David J. Ricker II



双打。我也尝试在观察窗口输入1.005 + 1.007

,它给出了相同的结果。


谢谢,

David J. Ricker II


" CJ Taylor" <无**** @ blowgoats.com>在消息中写道

news:vs ************ @ corp.supernews.com ...
Doubles. I have also tried simply typing 1.005+1.007 into the watch window
and it gives the same result.

Thanks,
David J. Ricker II

"CJ Taylor" <no****@blowgoats.com> wrote in message
news:vs************@corp.supernews.com...
您使用的是哪些数据类型?

David Ricker <哒************* @ hotmail.com>在消息中写道
新闻:eW ************** @ TK2MSFTNGP12.phx.gbl ...
What data types are you using?

"David Ricker" <da*************@hotmail.com> wrote in message
news:eW**************@TK2MSFTNGP12.phx.gbl...
我在添加两个数字时遇到问题。我想添加1.005
和1.007来提出2.012。应该够轻松吧?问题是
I am having problems adding two numbers. I am trying to add 1.005 and 1.007 to come up with 2.012. Should be easy enough right? Problem is


我一直得到2.0119999999999996作为我的结果。为什么会发生这种情况?
I keep getting 2.0119999999999996 as my result. Why is this happening?


有没有办法可以让它返回正确的结果?任何帮助都表示赞赏。

谢谢,
David J. Ricker II
there a way that I can get it to return the right result? Any help is
appreciated.

Thanks,
David J. Ricker II




他是什么......


尝试小数。看看会发生什么。

David Ricker <哒************* @ hotmail.com>在消息中写道

news:uX ************** @ TK2MSFTNGP10.phx.gbl ...
What the he.....

Try a decimal. see what happens.
"David Ricker" <da*************@hotmail.com> wrote in message
news:uX**************@TK2MSFTNGP10.phx.gbl...
双打。我也尝试在手表
窗口中输入1.005 + 1.007,结果相同。

谢谢,
David J. Ricker II
CJ Taylor <无**** @ blowgoats.com>在消息中写道
新闻:vs ************ @ corp.supernews.com ...
Doubles. I have also tried simply typing 1.005+1.007 into the watch window and it gives the same result.

Thanks,
David J. Ricker II

"CJ Taylor" <no****@blowgoats.com> wrote in message
news:vs************@corp.supernews.com...
您使用的数据类型是什么?

David Ricker <哒************* @ hotmail.com>在消息中写道
新闻:eW ************** @ TK2MSFTNGP12.phx.gbl ...
What data types are you using?

"David Ricker" <da*************@hotmail.com> wrote in message
news:eW**************@TK2MSFTNGP12.phx.gbl...
我在添加两个数字时遇到问题。我想添加1.005和1.007来提出2.012。应该够轻松吧?问题是
I am having problems adding two numbers. I am trying to add 1.005 and 1.007 to come up with 2.012. Should be easy enough right? Problem is


我一直得到2.0119999999999996作为我的结果。为什么这个
I keep getting 2.0119999999999996 as my result. Why is this


发生了?

happening? Is

有没有办法可以让它返回正确的结果?任何帮助都表示赞赏。

谢谢,
David J. Ricker II
there a way that I can get it to return the right result? Any help is
appreciated.

Thanks,
David J. Ricker II





这篇关于救命!数字没有正确添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆