# 32位浮点数

m的计算方式是

0 01111111 00000000000000000000000

0 10000000 0000000000000000000000
1和2之间，我能表示的数是有限的，比1大的浮点数，最小的值我只能取到
0 01111111 00000000000000000000001

``````std::numeric_limits<float>::epsilon()
``````

``````    std::cout.precision(15);

uint8_t array[4] = {0};
array[3] = 0x3F; array[2] = 0x80;
float* f = reinterpret_cast<float*>(array);
std::cout << "f = " << *f <<std::endl;

uint8_t array1[4] = {0};
array1[3] = 0x3F; array1[2] = 0x80; array1[0] = 0x1;
float* f1 = reinterpret_cast<float*>(array1);
std::cout << "f1 = " << *f1 << std::endl;

uint8_t array2[4] = {0};
array2[2] = 0x7F; array2[1] = 0xFF; array2[0] = 0xFF;
float* f2 = reinterpret_cast<float*>(array2);
std::cout << "f2 = " << *f2 << std::endl;

uint8_t array3[4] = {0};
array3[0] = 0x1;
float* f3 = reinterpret_cast<float*>(array3);
std::cout << "f3 = " << *f3 << std::endl;
``````

``````    uint8_t array4[4] = {0};
array4[3] = 0x7F; array4[2] = 0x80;
float* f4 = reinterpret_cast<float*>(array4);
std::cout << "f4 = " << *f4 << std::endl;

uint8_t array5[4] = {0};
array5[3] = 0x7F; array5[2] = 0x80; array5[0] = 0x3F;
float* f5 = reinterpret_cast<float*>(array5);
std::cout << "f5 = " << *f5 << std::endl;
``````

``````    uint8_t array6[4] = {0};
array6[3] = 0x7F; array6[2] = 0x7F; array6[1] = 0xFF; array6[0] = 0xFF;
float* f6 = reinterpret_cast<float*>(array6);
std::cout << "f6 = " << *f6 << std::endl;
``````