Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cirq-core/cirq/ops/arithmetic_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ def apply(self, *register_values: int) -> int | Iterable[int]:
1. The `apply` method is permitted to return values that have more bits
than the registers they will be stored into. The extra bits are
simply dropped. For example, if the value 5 is returned for a 2
qubit register then 5 % 2**2 = 1 will be used instead. Negative
qubit register then 5 % 2^2 = 1 will be used instead. Negative
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use double backticks instead, ie, ``5 % 2**2 = 1``, to avoid having ** interpreted as a bold-face markdown.
2^2 is a valid XOR expression which may confuse readers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks for pointing this out!

values are also permitted. For example, for a 3 qubit register the
value -2 becomes -2 % 2**3 = 6.
value -2 becomes -2 % 2^3 = 6.
2. When the value of the last `k` registers is not changed by the
gate, the `apply` method is permitted to omit these values
from the result. That is to say, when the length of the output is
Expand Down