32 位和 64 位操作系统中的双字节大小 [英] The Double byte size in 32 bit and 64 bit OS

查看:38
本文介绍了32 位和 64 位操作系统中的双字节大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行时 double 大小有区别吗我的应用程序在 32 位和 64 位环境下?

Is there a difference in double size when I run my app on 32 and 64 bit environment?

如果我没记错的话,32位环境下的double会占用0后的16位,而64位环境下的double会占用32位,对吗?

If I am not mistaken the double in 32 bit environment will take up 16 digits after 0, whereas the double in 64 bit will take up 32 bit, am I right?

推荐答案

不,一个 IEEE 754 double-精度浮点数总是64位.类似地,单精度 float 总是 32 位.

No, an IEEE 754 double-precision floating point number is always 64 bits. Similarly, a single-precision float is always 32 bits.

如果您的问题特别是关于 C# 和/或 .NET(如您的标签所示),所有的数据类型大小都是固定的,与您的系统架构无关.这与 Java 相同,但与 C 和 C++ 不同,后者的类型大小因平台而异.

If your question is about C# and/or .NET specifically (as your tag would indicate), all of the data type sizes are fixed, independent of your system architecture. This is the same as Java, but different from C and C++ where type sizes do vary from platform to platform.

整数类型在 C 和 C++ 中的不同体系结构上具有不同的大小是很常见的.例如,int 在 16 位 DOS 中为 16 位宽,在 Win32 中为 32 位宽.然而,IEEE 754 标准在浮点计算中无处不在,以至于 floatdouble 的大小在任何系统上不会变化在现实世界中找到--20 年前 double 是 64 位,今天也是.

It is common for the integral types to have different sizes on different architectures in C and C++. For instance, int was 16 bits wide in 16-bit DOS and 32 bits wide in Win32. However, the IEEE 754 standard is so ubiquitous for floating-point computation that the sizes of float and double do not vary on any system you will find in the real world--20 years ago double was 64 bits and so it is today.

这篇关于32 位和 64 位操作系统中的双字节大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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