Skip to content

Commit

Permalink
Use format-real when emitting a pauli sum prefactor
Browse files Browse the repository at this point in the history
Closes #908
  • Loading branch information
jbouwman authored and stylewarning committed Jan 5, 2024
1 parent ac4effe commit 3448732
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ast.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,7 @@ For example,
(format stream " ~a(" pauli-word)
(typecase prefactor
(number
(format stream "~a" prefactor))
(format-real prefactor stream))
((or symbol cons)
(print-instruction (make-delayed-expression nil nil prefactor) stream)))
(format stream ")")
Expand Down
12 changes: 12 additions & 0 deletions tests/printer-test-files/gold-standard/gh-issue-908.quil
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Input
DEFGATE SQRTSWAP p q AS PAULI-SUM:
XX(pi/8) p q
YY(pi/8) p q
ZZ(pi/8) p q
# Output
DEFGATE SQRTSWAP p q AS PAULI-SUM:
XX(pi/8) p q
YY(pi/8) p q
ZZ(pi/8) p q


0 comments on commit 3448732

Please sign in to comment.