microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/add-link-to-qsharp-application

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

library/chemistry/src/Utils.qs

25lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4import Std.Math.AbsD;
5
6/// # Summary
7/// Checks whether a `Double` number is not approximately zero.
8///
9/// # Input
10/// ## number
11/// Number to be checked
12///
13/// # Output
14/// Returns true if `number` has an absolute value greater than `1e-15`.
15function IsNotZero(number : Double) : Bool {
16 AbsD(number) > 1e-15
17}
18
19function RangeAsIntArray(range : Range) : Int[] {
20 mutable arr = [];
21 for i in range {
22 arr += [i];
23 }
24 return arr;
25}
26