-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle huge integers in OpenQASM 2 expression evaluator #12140
Conversation
This modifies the expression evaluator to directly parse the backing string data of an integer token in a floating-point context, which lets us handle numbers that would otherwise overflow a `usize`. It's possible for this to be totally valid, if, for example, the integer is a multiple of some very large power of two that doesn't overflow a double-precision float. We already needed to immediately cast the integer to a float, so this is just a more accurate way of doing the evaluation, and doesn't affect when we use integers in other contexts.
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 8646868413Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the changes!
* Handle huge integers in OpenQASM 2 expression evaluator This modifies the expression evaluator to directly parse the backing string data of an integer token in a floating-point context, which lets us handle numbers that would otherwise overflow a `usize`. It's possible for this to be totally valid, if, for example, the integer is a multiple of some very large power of two that doesn't overflow a double-precision float. We already needed to immediately cast the integer to a float, so this is just a more accurate way of doing the evaluation, and doesn't affect when we use integers in other contexts. * Clarify int/float split (cherry picked from commit fe69594)
@Mergifyio backport stable/0.46 |
✅ Backports have been created
|
* Handle huge integers in OpenQASM 2 expression evaluator This modifies the expression evaluator to directly parse the backing string data of an integer token in a floating-point context, which lets us handle numbers that would otherwise overflow a `usize`. It's possible for this to be totally valid, if, for example, the integer is a multiple of some very large power of two that doesn't overflow a double-precision float. We already needed to immediately cast the integer to a float, so this is just a more accurate way of doing the evaluation, and doesn't affect when we use integers in other contexts. * Clarify int/float split (cherry picked from commit fe69594)
) * Handle huge integers in OpenQASM 2 expression evaluator This modifies the expression evaluator to directly parse the backing string data of an integer token in a floating-point context, which lets us handle numbers that would otherwise overflow a `usize`. It's possible for this to be totally valid, if, for example, the integer is a multiple of some very large power of two that doesn't overflow a double-precision float. We already needed to immediately cast the integer to a float, so this is just a more accurate way of doing the evaluation, and doesn't affect when we use integers in other contexts. * Clarify int/float split (cherry picked from commit fe69594) Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
) * Handle huge integers in OpenQASM 2 expression evaluator This modifies the expression evaluator to directly parse the backing string data of an integer token in a floating-point context, which lets us handle numbers that would otherwise overflow a `usize`. It's possible for this to be totally valid, if, for example, the integer is a multiple of some very large power of two that doesn't overflow a double-precision float. We already needed to immediately cast the integer to a float, so this is just a more accurate way of doing the evaluation, and doesn't affect when we use integers in other contexts. * Clarify int/float split (cherry picked from commit fe69594) Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
* Handle huge integers in OpenQASM 2 expression evaluator This modifies the expression evaluator to directly parse the backing string data of an integer token in a floating-point context, which lets us handle numbers that would otherwise overflow a `usize`. It's possible for this to be totally valid, if, for example, the integer is a multiple of some very large power of two that doesn't overflow a double-precision float. We already needed to immediately cast the integer to a float, so this is just a more accurate way of doing the evaluation, and doesn't affect when we use integers in other contexts. * Clarify int/float split
We fixed handling of giant integers in gate expression positions Qiskitgh-12140, and this commit fixes the handling in conditionals. Unfortunately, this means pulling in big-int handling properly; the integers simply _are_ bigints, and we're not immediately converting them into something else. The need to support this may influence how the Rust-space data models of `QuantumCircuit` evolve.
* Fix parsing of huge OpenQASM 2 conditionals We fixed handling of giant integers in gate expression positions gh-12140, and this commit fixes the handling in conditionals. Unfortunately, this means pulling in big-int handling properly; the integers simply _are_ bigints, and we're not immediately converting them into something else. The need to support this may influence how the Rust-space data models of `QuantumCircuit` evolve. * Move `num-bigint` dependency to workspace
* Fix parsing of huge OpenQASM 2 conditionals We fixed handling of giant integers in gate expression positions gh-12140, and this commit fixes the handling in conditionals. Unfortunately, this means pulling in big-int handling properly; the integers simply _are_ bigints, and we're not immediately converting them into something else. The need to support this may influence how the Rust-space data models of `QuantumCircuit` evolve. * Move `num-bigint` dependency to workspace (cherry picked from commit 85f9860) # Conflicts: # Cargo.toml # crates/accelerate/Cargo.toml
* Fix parsing of huge OpenQASM 2 conditionals We fixed handling of giant integers in gate expression positions gh-12140, and this commit fixes the handling in conditionals. Unfortunately, this means pulling in big-int handling properly; the integers simply _are_ bigints, and we're not immediately converting them into something else. The need to support this may influence how the Rust-space data models of `QuantumCircuit` evolve. * Move `num-bigint` dependency to workspace (cherry picked from commit 85f9860)
* Fix parsing of huge OpenQASM 2 conditionals We fixed handling of giant integers in gate expression positions gh-12140, and this commit fixes the handling in conditionals. Unfortunately, this means pulling in big-int handling properly; the integers simply _are_ bigints, and we're not immediately converting them into something else. The need to support this may influence how the Rust-space data models of `QuantumCircuit` evolve. * Move `num-bigint` dependency to workspace (cherry picked from commit 85f9860)
* Fix parsing of huge OpenQASM 2 conditionals We fixed handling of giant integers in gate expression positions gh-12140, and this commit fixes the handling in conditionals. Unfortunately, this means pulling in big-int handling properly; the integers simply _are_ bigints, and we're not immediately converting them into something else. The need to support this may influence how the Rust-space data models of `QuantumCircuit` evolve. * Move `num-bigint` dependency to workspace (cherry picked from commit 85f9860) Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
* Fix parsing of huge OpenQASM 2 conditionals We fixed handling of giant integers in gate expression positions gh-12140, and this commit fixes the handling in conditionals. Unfortunately, this means pulling in big-int handling properly; the integers simply _are_ bigints, and we're not immediately converting them into something else. The need to support this may influence how the Rust-space data models of `QuantumCircuit` evolve. * Move `num-bigint` dependency to workspace (cherry picked from commit 85f9860) Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
* Fix parsing of huge OpenQASM 2 conditionals We fixed handling of giant integers in gate expression positions Qiskitgh-12140, and this commit fixes the handling in conditionals. Unfortunately, this means pulling in big-int handling properly; the integers simply _are_ bigints, and we're not immediately converting them into something else. The need to support this may influence how the Rust-space data models of `QuantumCircuit` evolve. * Move `num-bigint` dependency to workspace
Summary
This modifies the expression evaluator to directly parse the backing string data of an integer token in a floating-point context, which lets us handle numbers that would otherwise overflow a
usize
. It's possible for this to be totally valid, if, for example, the integer is a multiple of some very large power of two that doesn't overflow a double-precision float.We already needed to immediately cast the integer to a float, so this is just a more accurate way of doing the evaluation, and doesn't affect when we use integers in other contexts.
Details and comments
Fix #11561