big_endian_int_to_digits(val: int, *, digit_count: Optional[int] = None, base: Union[int, Iterable[int]]) → List[int]¶
Separates an integer into big-endian digits.
val – The integer to get digits from. Must be non-negative and less than the maximum representable value, given the specified base(s) and digit count.
base – The base, or list of per-digit bases, to separate val into. When a list of bases is specified, the last entry in the list is the base for the last entry of the result (i.e. the least significant digit). That is to say, the bases are also specified in big endian order.
digit_count – The length of the desired result.
The list of digits.
ValueError – Unknown digit count. The base was specified as an integer and a digit_count was not provided. Inconsistent digit count. The base was specified as a per-digit list, and digit_count was also provided, but they disagree.
>>> cirq.big_endian_int_to_digits(11, digit_count=4, base=10) [0, 0, 1, 1]
>>> cirq.big_endian_int_to_digits(11, base=[2, 3, 4]) [0, 2, 3]