FiniteFact function

Namespace: Microsoft.Quantum.Diagnostics

Package: Microsoft.Quantum.QSharp.Foundation

Declares that a given floating-point value represents a finite number, failing when 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 printed in the case that d is either not finite, or not a number.

Output : Unit

Example

The following Q# code will fail when run:

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

See Also