In this question the OP tried to isolate an elusive bug in a big program. He observed some double
values and then tried to hard code them as input to a smaller test program. The ideea is great for isolating such a bug.
The method chosen however violates the String Aliasing rule, introducing UB, thus the test is completely unreliable:
watch in debugger the expression:
+------------------------+----------------------| | Watch Expression | Value | +------------------------+----------------------| | *(long long int *)(&a) | 4594681439063077250 | +------------------------+----------------------|
and then assign it in the test program:
double a; *(long long int *)(&a) = 4594681439063077250;
(I strongly suspect) He did this in order to preserve the exact double
value, bit by bit.
The question: How to assign to a double the exact value - bit by bit - observed in a debug session?