EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.
0 sur 1 ont trouvé cela utile - Évaluez ce sujet

# Single.IsNaN Method

.NET Framework 1.1

Returns a value indicating whether the specified number evaluates to not a number (NaN).

```[Visual Basic]
Public Shared Function IsNaN( _
ByVal f As Single _
) As Boolean
[C#]
public static bool IsNaN(
float f
);
[C++]
public: static bool IsNaN(
float f
);
[JScript]
public static function IsNaN(
f : float
) : Boolean;```

#### Parameters

f
A single-precision floating point number.

#### Return Value

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

#### Remarks

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

#### Example

[Visual Basic, C#, C++] The following sample demonstrates the IsNaN method.

```[Visual Basic]
' This will return true.
If Single.IsNaN(0 / zero) Then
Console.WriteLine("Single.IsNan() can determine whether a value is not-a-number.")
End If

[C#]
// This will return true.
if (Single.IsNaN(0 / zero))
{
Console.WriteLine("Single.IsNan() can determine whether a value is not-a-number.");
}

[C++]
// This will return true.
if (Single::IsNaN(0 / zero)) {
Console::WriteLine(S"Single::IsNan() can determine whether a value is not-a-number.");
}
```

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button in the upper-left corner of the page.

#### Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard