Skip to content

Latest commit

 

History

History
62 lines (38 loc) · 1.58 KB

microsoft.quantum.diagnostics.finitefact.md

File metadata and controls

62 lines (38 loc) · 1.58 KB
uid title ms.date ms.topic qsharp.kind qsharp.namespace qsharp.name qsharp.summary
Microsoft.Quantum.Diagnostics.FiniteFact
FiniteFact function
7/28/2023 12:00:00 AM
managed-reference
function
Microsoft.Quantum.Diagnostics
FiniteFact
Checks whether a given floating-point value represents a finite number, and throws an exception if this is not the case.

FiniteFact function

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Diagnostics

Package: Microsoft.Quantum.QSharp.Foundation

Checks whether a given floating-point value represents a finite number, and throws an exception if this is not the case.

function FiniteFact (d : Double, message : String) : Unit

Input

d : Double

The floating-point value that is to be checked.

message : String

Failure message to be used as an error message if d is either not finite, or not a number.

Output : Unit

Example

The following Q# code will throw an exception:

FiniteFact(NaN(), "NaN is not a finite number.");

See Also

  • Microsoft.Quantum.Diagnostics.Fact