You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
593 B

#include <stdio.h>
#define PRINT() do { \
printf("%lf -> %02x %02x %02x %02x %02x %02x %02x %02x\n", \
u.d, \
(unsigned int) u.x[0], \
(unsigned int) u.x[1], \
(unsigned int) u.x[2], \
(unsigned int) u.x[3], \
(unsigned int) u.x[4], \
(unsigned int) u.x[5], \
(unsigned int) u.x[6], \
(unsigned int) u.x[7]); \
} while (0)
int main(int argc, char *argv[]) {
volatile union {
double d;
unsigned char x[8];
} u;
u.d = 0.0;
PRINT();
/* In TCC, with default options, this operation does not change the
* output. In GCC it does.
*/
u.d = -u.d;
PRINT();
}