System::Equals< float, float > method

System::Equals< float, float > method

Specialization for single-precision floating point values. Although two floating point NaNs are defined by IEC 60559:1989 to always compare as unequal, the contract for System.Object.Equals, requires that overrides must satisfy the requirements for an equivalence operator. Therefore, System.Double.Equals and System.Single.Equals return True when comparing two NaNs, while the equality operator returns False in that case, as required by the standard.

bool System::Equals<float, float>(const float &a, const float &b)
ParameterTypeDescription
aconst float&The first comparand
bconst float&The second comparand

ReturnValue

True if both values are NaN or are equal, otherwise - false

See Also