I\'m trying to run some tests with conversions and castings of floats to other types and I want to set my float variable to different values of nan.
\"a bit-wise exa
Use memcpy:
memcpy
int32_t i = 0x7FC00000; float f; memcpy(&f, &i, sizeof(f));
You could also assert that sizeof(f) == sizeof(i), but if you know that floats are IEEE then presumably you also know what size the basic types are.
sizeof(f) == sizeof(i)