I wrote this code to overload the unary operator- on a matrix class:
const RegMatrix RegMatrix::operator-()const{
RegMatrix result(numRow,numCol);
int i,j;
for(i=0;i<numRow;++i)
for(j=0;j<numCol;++j){
result.setElement(i,j,(-_matrix[i][j]));
}
return result;
}
When i ran my program with debugger in visual studio, it showed me that when the operation is done on a double equals zero, it inserts the result matrix the number -0.00000.
Is it some weird VS-display feature, or is it something i should handle carefully?
For more information see Signed Zero wiki page.