You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way this is implemented for double is that the == operator obeys the IEEE rule but Equals doesn't:
[Fact]publicvoidDoubleEqualityOpNaNTest(){doublea=double.NaN;// Test passesAssert.False(a==a);}[Fact]publicvoidDoubleEqualsNaNTest(){doublea=double.NaN;// Test failsAssert.False(a.Equals(a));}
Which is strange as I would expect == and Equals to be consistent, but it is even mentioned in the docs.
The non-generic Vector types return false for both the operator and Equals method, which is what is currently implemented here.
Also note that if you use the equality operator generated for records with double properties, as it uses the double Equals method, neither the == operator nor Equals method returns false:
readonlyrecordstructDoublePropertyRecord(doubleValue);[Fact]publicvoidDoublePropertyRecordEqualsNaNTest1(){DoublePropertyRecorda=newDoublePropertyRecord(double.NaN);// Test failsAssert.False(a==a);}[Fact]publicvoidDoublePropertyRecordEqualsNaNTest2(){DoublePropertyRecorda=newDoublePropertyRecord(double.NaN);// Test failsAssert.False(a.Equals(a));}
The text was updated successfully, but these errors were encountered:
Under IEEE rules NaN is not equal to NaN.
The way this is implemented for double is that the == operator obeys the IEEE rule but Equals doesn't:
Which is strange as I would expect == and Equals to be consistent, but it is even mentioned in the docs.
The non-generic Vector types return false for both the operator and Equals method, which is what is currently implemented here.
Also note that if you use the equality operator generated for records with double properties, as it uses the double Equals method, neither the == operator nor Equals method returns false:
The text was updated successfully, but these errors were encountered: