microsoft/qdk

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
billti/wgpu

Branches

Tags

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

Clone

HTTPS

Download ZIP

samples/language/BigInt.qs

26lines · modecode

1/// # Sample
2/// BigInt
3///
4/// # Description
5/// Value literals for the `BigInt` type are always postfixed with L and
6/// can be expressed in binary, octal, decimal, or hexadecimal representation.
7/// `BigInt`s can be arbitrarily large, as opposed to `Int`s which have a size limit.
8namespace MyQuantumApp {
9
10 @EntryPoint()
11 operation Main() : BigInt {
12 // Numbers can be declared in hex, octal, decimal, or binary.
13 let foo = 0x42L;
14 let foo = 0o42L;
15 let foo = 42L;
16 let foo = 0b101010L;
17
18 // Numbers can be operated upon in the usual ways, with addition (+), subtraction (-),
19 // multiplication (*), division (/), modulo (%), and exponentiation (^).
20 let foo = foo + 1L;
21 let foo = foo % 2L;
22 // `BigInt`s being raised to an exponent take an `Int` as the exponent.
23 let foo = foo^2;
24 return foo;
25 }
26}
27