#include <iostream>

using namespace std;
union Test {
    float a;
    struct {
        int other:31;
        int sign:1;
    } b;
};

int main() {
    Test test;
    Test test2;
    test.a = -0.0;
    test2.a = +0.0;
    cout << test.b.sign << endl;
    cout << test2.b.sign << endl;
    return 0;
}

Add a code snippet to your website: www.paste.org