什么是双数据类型的最小一步? (。净) [英] What is the minimal step in double data type? (.NET)

查看:117
本文介绍了什么是双数据类型的最小一步? (。净)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是有点理论,但实际上我需要在实践中。

My question is a bit theoretical but actually I need it in practice.

让我们假设我们有两个变量的 X 具有一定的下一个双号的 X (因为你已经知道,我们不能继续的任意的现实中的双由于实数是无限的,即使在0到1的区间)。

Let's assume that we have two double variables X and Y. Y is certain next double number of X (as you already know we can't keep any real number in double because real number are infinite even in 0 to 1 interval).

难道(Y - X)是不变的?如果有什么是它的价值呢?

Does (Y - X) is constant? And if yes what is it's value?

P.S。我的问题是有关Microsoft.NET框架。

P.S. My question is related to Microsoft.NET Framework.

推荐答案

在.NET两个double值之间的最小差值是的 Double.Epsilon

The minimum difference between two double values in .NET is Double.Epsilon.

至于比较双重价值,看到了答案这太问题有用的信息(而作为公认的答案说,十进制应使用双尽可能)代替。

As for comparing double values, see the answers to this SO question for useful information (and as the accepted answer says, Decimal should be used instead of Double whenever possible).

这篇关于什么是双数据类型的最小一步? (。净)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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