System.Single.IsNaN Method

Returns a value that indicates whether the specified value is not a number (float.NaN).

Syntax

[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
public static bool IsNaN (float f)

Parameters

f
A single-precision floating-point number.

Returns

true if f evaluates to not a number (float.NaN); otherwise, false.

Remarks

Floating-point operations return float.NaN to signal that that result of the operation is undefined. For example, dividing 0.0 by 0.0 results in float.NaN.

Note:

float.IsNaN(float) returns false if a float value is either float.PositiveInfinity or float.NegativeInfinity. To test for these values, use the float.IsInfinity(float), float.IsPositiveInfinity(float), and float.IsNegativeInfinity(float) methods.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0