I was running some println statements for debugging and couldn't find out what was wrong with my code.
In the end I cut it right back to the following sketch and saw the problem was with println().
The sketch should print out 4038021375 but instead prints out "4038021376.00"!
I initialised the double with a certain thirty two bit pattern that I wanted (B11110000101011110101000011111111) assuming that you could use all the bits like an integer and not worrying about the decimal value. As long as you don't exceed the number of bits in the variable and watch the twos complement you can't go wrong........... not!
the print() and println() functions print floating point numbers to 2 dp by default. This means that even if the float is a whole number you will get two numbers following the decimal point.
If you did this for example: