VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/single-isnan-method-in-c-sharp-with-examples/

⇱ Single.IsNaN() Method in C# with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Single.IsNaN() Method in C# with Examples

Last Updated : 11 Jul, 2025
In C#, Single.IsNaN(Single) is a Single struct method. This method is used to check whether the specified floating-point value is not a number (NaN).
Syntax: public static bool IsNaN (float f); Parameter: f: It is a single-precision floating-point number of type System.Single.
Return Type: This function returns a boolean value i.e. True, if specified value is not a number(NaN), otherwise returns False. Example:
Output:
Infinity is not NaN
NaN is NaN
Note:
  • This method returns false if a Single value is either PositiveInfinity or NegativeInfinity.
  • Floating point operation returns a NaN to show that the result of the operation is undefined.
Reference:
Comment
Article Tags:

Explore