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
| Format | Meaning | Example |
|---|---|---|
(omitted) | Default π/2 for RX, RY, RZ, P | RX 0 |
plain number | Always a multiple of π (piradians) | 0.5 → π/2 |
pi, π, fractions | Symbolic π expressions | pi/2, -pi/4, 2*pi/3 |
…deg | Degrees | 90deg, 45degrees |
…rad | Radians | 1rad, 1.5708radians |
…pirad | Explicit π-multiple | 0.5pirad, 0.25piradians |
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.
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:
| Assignment | On a gate line | Result |
|---|---|---|
c = 0.5 | RY 0 c | Plain number, so it is piradians: π/2 |
c = 1/2 | RY 0 c | Arithmetic without pi is still a plain number: π/2 |
c = pi/2 | RY 0 c | Contains pi, so it is radians: π/2 |
c = 2/pi | RY 0 c | Dividing by pi stores a π-multiple: 2 radians |
c = 30deg | RY 0 c | Suffix wins: π/6 |
ang = 2 * (2**j) * phi | CP [w[j], w[t]] ang | The 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.