-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix test failure on differing precision of float in proto string #5911
Fix test failure on differing precision of float in proto string #5911
Conversation
Problem: CI Pytest MacOS (3.10) fails because float value is output with a lower precision than in expected textproto. (https://github.com/quantumlib/Cirq/actions/runs/3192951160/jobs/5211002538) Solution: Update expected textproto to a lower precision and replace high-precision values in the tested string.
@@ -269,6 +269,7 @@ def test_xeb_to_calibration_layer(): | |||
layer_str = str(new_layer) | |||
# Fix precision issues | |||
layer_str = re.sub(r'0.004999\d+', '0.005', layer_str) | |||
layer_str = re.sub(r'\b0.78539818\d*', '0.7853982', layer_str) |
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.
Could we fix this by setting theta
on the fsim gate to a different value that can be exactly represented by floats, e.g. theta=0.5
? We could do something similar on fatol
to avoid the need for the previous string substitution hack, setting it to something like 2**-7 == 0.0078125
instead of 0.005
.
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.
Sure, that is nicer than substitution. Done in 6148c40.
…ntumlib#5911) Problem: CI Pytest MacOS (3.10) fails because float value is output with a lower precision than in the expected textproto, https://github.com/quantumlib/Cirq/actions/runs/3192951160/jobs/5211002538. Solution: Test with parameters that have exact decimal representation, theta = 0.75, fatol = xatol = 2**-7 = 0.0078125.
Problem: CI Pytest MacOS (3.10) fails because float value is output with
a lower precision than in the expected textproto,
https://github.com/quantumlib/Cirq/actions/runs/3192951160/jobs/5211002538.
Solution: Test with parameters that have exact decimal representation,
theta = 0.75, fatol = xatol = 2**-7 = 0.0078125.