c#double定义_C,C ++和C#中Double的定义

c#double定义

The double is a fundamental data type built into the compiler and used to define numeric variables holding numbers with decimal points. C, C++, C# and many other programming languages recognize the double as a type. A double type can represent fractional as well as whole values. It can contain up to 15 digits in total, including those before and after the decimal point. 

double是编译器内置的基本数据类型,用于定义包含带小数点数字的数字变量 。 C,C ++, C#和许多其他编程语言将double视为一种类型。 双精度类型可以表示小数和整数值。 它最多可包含在总共 15位,包括那些之前和小数点后。

双重用途 ( Uses for Double )

The float type, which has a smaller range, was used at one time because it was faster than the double when dealing with thousands or millions of floating-point numbers. Because calculation speed has increased dramatically with new processors, however, the advantages of floats over doubles are negligible. Many programmers consider the double type to be the default when working with numbers that require decimal points. 

一次使用较小范围的浮点类型,因为在处理成千上万个浮点数时,它比双精度类型快。 但是,由于新处理器的计算速度已大大提高,因此浮点数比双精度点的优势微不足道。 许多程序员在处理需要小数点的数字时都将double类型视为默认类型。

Double vs.Float和Int ( Double vs. Float and Int )

Other data types include float and int. The double and float types are similar, but they differ in precision and range:

其他数据类型包括floatint 。 double和float类型是相似的,但是它们的精度和范围不同:

  • A float is a single precision, 32-bit floating-point data type that accommodates seven digits. Its range is approximately 1.5 × 10−45 to 3.4 × 1038.

    浮点数是一种单精度的32位浮点数据类型,可容纳7位数字。 其范围约为1.5×10 -45至3.4×10 38。

  • A double is a double-precision, 64-bit floating-point data type. It accommodates 15 to 16 digits, with a range of approximately 5.0 × 10−345 to 1.7 × 10308.

    double是双精度的64位浮点数据类型。 它可以容纳15到16位数字,范围约为5.0×10 -345到1.7×10 308

The int also deals with data, but it serves a different purpose. Numbers without fractional parts or any need for a decimal point can be used as int. Thus, the int type holds only whole numbers, but it takes up less space, the arithmetic is usually faster, and it uses caches and data transfer bandwidth more efficiently than the other types. 

整数还处理数据,但它有不同的用途。 没有小数部分或不需要小数点的数字都可以用作int。 因此,int类型仅包含整数,但占用的空间较小,算术通常更快,并且与其他类型相比,它更有效地使用缓存和数据传输带宽。

翻译自: https://www.thoughtco.com/definition-of-double-958065

c#double定义

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值