#include #include int is_negative(double n) { // Not a good idea: long x = *(long *)&n; long x; memcpy(&x, &n, sizeof(long)); return (x >> 63) & 1; } int main() { printf("%d\n", is_negative(10.0)); printf("%d\n", is_negative(-10.0)); return 0; }