I made the following change, and result is as expected:
double x = asDouble(-2147483648.0, 4); // instead of asDouble(-2147483648, 4);
Your code is not compiled for me, the error is:
error C4146: unary minus operator applied to unsigned type, result still unsigned
So, your conditional precision is OK, the problem is that 2147483648 is more than maximal unsigned int value, and applying unary minus operator to it gives compiler error in my case, and unexpected result in your case. Probably your compiler gives some warning for this line, don't ignore it. Output:
-214748.3648
0.5456
Tested with VC++ 2015.