having negative 0 as my result after multiplying zero with a negative number

guys I need your help on an error am having. I multiplied 0 by -4 and my result is -0 instead of 0. I tried to change the data type put It won't work.
this is my code:

#include <iostream>


int main () {

double b, c;
std::cout<<"b: ";
std::cin>>b;
std::cout<<"c: ";
std::cin>>c;
std::cout<<b*c<<std::endl;
return 0;

}
See: http://en.wikipedia.org/wiki/Signed_zero

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>

int main ()
{

    double b, c;
    std::cout << "b: ";
    std::cin >> b;
    std::cout << "c: ";
    std::cin >> c;

    double result = b * c ;
    if( result == 0.0 ) result = 0 ;
    std::cout << result << '\n' ;
}
that was helpful, tnx
Topic archived. No new replies allowed.