Is it wrong to compare a double to 0 like this: doubleVariable==0?

后端 未结 6 776
夕颜
夕颜 2021-01-04 04:57

It is ok to do this?

double doubleVariable=0.0;
if (doubleVariable==0) {
   ...
}

Or this code would suffer from potential rounding problem

6条回答
提交回复
热议问题