c - How can I store the bits of a uint64_t inside of a double? -
basically have uint64_t
actual value not care about. need store in double
can store bits in object in r (if don't know is, that's fine, doesn't matter question).
so means of storing 64 bits of uint64_t
inside of double
, convert double
holding bits original uint64_t
.
i've been banging head against wall on quite bit (is pun?) , appreciated!!!
as stated in comments, can use memcpy copy bits uint64_t
double
.
this works because size of double
same 1 of uint64_t
(8 bytes).
if try display values, won't same result, though. indeed double stores both positive , negative values, floating point, whereas uint64_t
is... unsigned , whole.
the binary representation same, interpreted value different.