cirq.big_endian_digits_to_int
Returns the big-endian integer specified by the given digits and base.
cirq.big_endian_digits_to_int(
digits: Iterable[int], *, base: Union[int, Iterable[int]]
) -> int
Args |
digits
|
Digits of the integer, with the least significant digit at the
end.
|
base
|
The base, or list of per-digit bases, to use when combining the
digits into an integer. When a list of bases is specified, the last
entry in the list is the base for the last entry of the digits list
(i.e. the least significant digit). That is to say, the bases are
also specified in big endian order.
|
Raises |
ValueError
|
One of the digits is out of range for its base.
The base was specified per-digit (as a list) but the length of the
bases list is different from the number of digits.
|
Examples |
>>> cirq.big_endian_digits_to_int([0, 1], base=10)
1
cirq.big_endian_digits_to_int([1, 0], base=10)
10
cirq.big_endian_digits_to_int([1, 2, 3], base=[2, 3, 4])
23
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-27 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-27 UTC."],[],[]]