Readers: 8
2024-05-06T15:29:20 rostiNun, 3.9 & 0xFFOder auch die Frage wie das Bitmuster einer FLießkommazahl aussieht.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
double x = 3.9
(double) 3.9000000
sizeof(x)
(unsigned long) 8
x & 0xFF
error: invalid operands to binary expression ('double' and 'int')
x & 0xFF
~ ^ ~~~~
static_cast<uint64_t>(x) & 0xFF
(unsigned long) 3
*reinterpret_cast<uint64_t*>(&x)
(unsigned long) 4615964438073389875
*reinterpret_cast<uint64_t*>(&x) & 0xFF
(unsigned long) 51