一、C/C++(预编译器、机器有关)
分类: 整型(int) 、浮点型(float) 、字符型(char) 、指针型(*) 、无值型(void)以及自定义类型(struct union)
(1)整型
type | notes |
signed short int | 简写short或int,字长2 字节,范围是-32768~32767 |
signed long int | 简写long,字长4 字节,范围是-2147483648~2147483647 |
unsigned short int | 简写unsigned int,字长2 字节,范围是0~65535 |
unsigned long int | 简写unsigned long,字长4 字节,范围是0~4294967295 |
(2) 浮点型
type | note |
float | 4byte.32bit,3.4x10-38E~3.4x10+38E |
double | 8byte ,64bit,1.7x10-308E~1.7x10+308E |
(3)字符型
char 通常占一个字节
unsigned char
转换规则:(char 、short)->int -> unsigned -> long -> double <- float
二、Java
(1)整数类──byte, short, int, long
8 bits byte -2 ^7... 2 ^7 -1
16 bits short -2 ^15 ... 2^ 15-1
32 bit int -2 ^31 .. 2 ^31 -1
64 bits long -2^ 63... 2 ^63-1
(2)char 16-bit Unicode
(3)浮点型
32 bits float
64 bits double
(4)boolean
三 、javascript无类型
(1)Number型 即可表示32bit的整数,又可以表示64bit的浮点数
对应于32bit 整型
>>带符号的右移,符号位不参与移动
>>>无符号右移,符号位参与移动
Number.MIN_VALUE~Number.MAX_VALUE5e-324~1.7976931348623157e+308
(2)String类型16bit Unicode 串