In the following program, float variable print negative zero.
//g++  5.4.0
#include <iostream>
int main()
{
    float val = 0;
    val = -val;
    std::cout<<val<<std::endl;
}
Output:
-0
But, in following code
//g++  5.4.0
#include <iostream>
int main()
{
    int val = 0;
    val = -val;
    std::cout<<val<<std::endl;
}
Output:
0
print positive zero.
Why int variable doesn't print negative zero?
 
     
     
    
 
    