32位平台

char 1个字节8位

short 2个字节16位

int 4个字节32位

long 4个字节

long long 8个字节

指针 4个字节

64位平台

char 1个字节

short 2个字节

int 4个字节

long 8个字节

long long 8个字节

指针 8个字节

范围

char -128 ~ +127 (1 Byte)
short -32767 ~ + 32768 (2 Bytes)
unsigned short 0 ~ 65536 (2 Bytes)
int -2147483648 ~ +2147483647 (4 Bytes)
unsigned int 0 ~ 4294967295 (4 Bytes)
long long -9223372036854775808 ~ +9223372036854775807 (8 Bytes)
double 1.7 * 10^308 (8 Bytes)

双精度浮点数(double)使用 64 位(8字节) 来存储一个浮点数。 它可以表示十进制的15或16位有效数字,其可以表示的数字的绝对值范围大约是\( 1.7 \times 10^{-308} , \text{1.7} \times 10^{308} \)

sign bit(符号): 用来表示正负号,1bit

exponent(指数): 用来表示次方数,11bits

mantissa(尾数): 用来表示精确度,52bits

\(\text{Mantissa} \times \text{2}^\text{exponent}\)

单精度浮点数使用32位(4字节)存储。

第1位表示正负,中间8位表示指数,后23位表示尾数。

相关文章:

  • 2022-12-23
  • 2021-04-16
  • 2021-05-13
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-01-28
猜你喜欢
  • 2022-01-02
  • 2022-01-03
  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
相关资源
相似解决方案