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