You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Integer division for casts, int array elements, bitwise results, ** and int-returning subroutines #480
After #474, / divides as integers when both operands are integer literals or int/uint variables. Other integer-typed operands still use true division:
OPENQASM 3.0;
include"stdgates.inc";
qubit[1] q;
int[32] a = 2;
int[32] b = 3;
float[64] f = 7.9;
array[int[32], 2] arr = {7, 1};
def h() -> int[32] { return 7; }
rx(int[32](f) / a) q[0]; // rx(3.5), spec gives 3rx(arr[0] / a) q[0]; // rx(3.5), spec gives 3rx((b | 4) / a) q[0]; // rx(3.5), spec gives 3rx(h() / a) q[0]; // rx(3.5), spec gives 3
Casts to int/uint, elements of integer arrays, bitwise and shift results on integers, int ** int, and subroutines that return int/uint are all integer-typed in the spec (language/types.rst, language/classical.rst). Raised in the review of #474.
Activity
HVSharma12 commentedon Nov 18, 2026
I have a fix for this ready on top of #474. I'll open the PR as soon as #474 is merged.