Angles & Units

Rotation gates accept angles in several notations. A bare number is always a multiple of π, so RX 0 0.5 is π/2 in every program. Add a suffix when you want degrees or radians.

Source code formats

FormatMeaningExample
(omitted)Default π/2 for RX, RY, RZ, PRX 0
plain numberAlways a multiple of π (piradians)0.5 → π/2
pi, π, fractionsSymbolic π expressionspi/2, -pi/4, 2*pi/3
…degDegrees90deg, 45degrees
…radRadians1rad, 1.5708radians
…piradExplicit π-multiple0.5pirad, 0.25piradians
Bare numbers are piradians. RY 0 0.25 is π/4, RY 0 45deg is π/4 too, and so is RY 0 0.7854rad. No setting changes this, so a program means the same thing on every computer.
Gate label units (Settings button, default degrees) only change the labels drawn on the circuit diagram. They never change how your source is read.

Symbolic π in angles

RY 0 pi/2
RZ(2*pi/3) 1
P 0 45deg
RX 0 1rad

Anything with pi in it is real π: pi/2 is π/2 radians. Don't write 0.5pi, because that is the number 0.5 × 3.14159 read as piradians (about 4.93 radians). Write 0.5, pi/2 or 0.5pirad.

Variables and expressions as angles

A variable used in an angle position means exactly what its right-hand side would have meant on the gate line, and the rule is the same at the top level and inside function bodies:

AssignmentOn a gate lineResult
c = 0.5RY 0 cPlain number, so it is piradians: π/2
c = 1/2RY 0 cArithmetic without pi is still a plain number: π/2
c = pi/2RY 0 cContains pi, so it is radians: π/2
c = 2/piRY 0 cDividing by pi stores a π-multiple: 2 radians
c = 30degRY 0 cSuffix wins: π/6
ang = 2 * (2**j) * phiCP [w[j], w[t]] angThe phase-estimation pattern: a π-multiple computed from other numbers

The same variable keeps its numeric value in counts and conditions: after a = pi, LOOP round(a) runs three times.

Show Evaluated Labels

When Show Evaluated Labels is on in the Settings button (the default), LOOP blocks and some wire lists display their evaluated values on the circuit (e.g. loop count 12 after parsing 4*3). Turn it off for a cleaner diagram when debugging layout.