我有这个if
表达式,
void Foo()
{
System.Double something = GetSomething();
if (something == 0) //Comparison of floating point numbers with equality
// operator. Possible loss of precision while rounding value
{}
}
这个表达式是否等同于
void Foo()
{
System.Double something = GetSomething();
if (something < 1)
{}
}
因为这样的话,当我输入例如0.9的值时,可能会有问题进入if
语句。