您的位置:首页 > 其它

int,long long,double,float等的范围(和精度)

2017-10-31 07:04 429 查看
名称 全称类型说明符 缩写类型说明符 位数 范围

整型 int int 16位 -32768至+32767

无符号整型 unsigned int unsigned 16位 0 至 65,535

短整型 short int short 16位 -32768至+32767

无符号短整型 unsigned short int unsigned short 16位 0 至 65,535

长整型 long int long 32位 -2,147,483,648 至 2,147,483,647( -2^63 ~ 2^63-1)

无符号长整型 unsigned long int unsigned long 32位 0至4,294,967,295

double 和 float 的区别是double精度高,有效数字16位,float精度7位。但double消耗内存是float的两倍,double的运算速度比float慢得多,在不确定的情况下还是尽量用double以保持正确性.

类型 比特数 有效数字 数值范围

float 32 6-7 -3.4*10(-38)~3.4*10(38)

double 64 15-16 -1.7*10(-308)~1.7*10(308)

long double 128 18-19 -1.2*10(-4932)~1.2*10(4932)

(以上内容来源于“百度知道”)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: