Hello
Id like to take a double and split it into its 32 bit high and low bits. Id like to be left with 2 pointers to both 'halves'.
Heres what I'm thinking:
So it was called with 0xFFFFFFFF00000000 Id expect to see 0x00000000 and 0xFFFFFFFF printed(or maybe I have it backwards), but I dont. I'm not sure why.Code:void split(double x) { unsigned int *low_bits = (unsigned int *)&x; unsigned int *high_bits = (unsigned int *)(&x + sizeof(int)); printf("low = 0x%0000008x\n", *low_bits); printf("high = 0x%0000008x\n", *high_bits); }
Thanks
(Yeah, this is kind of cheesy and probably a bad idea in general but I need something like this for my computer architecture class. Were working with floating points and we can only use ints. This will make life much easier)