Stim icon indicating copy to clipboard operation
Stim copied to clipboard

Equal circuits are not equal

Open Strilanc opened this issue 3 years ago • 2 comments

In https://github.com/Strilanc/heavy-hex-demo/blob/main/main_test.py I had to turn a circuit into a str and reparse it in order for it to be equal. Clearly something under the hood with no externally-observable difference is causing the equality to fail. That shouldn't happen.

Strilanc avatar Jul 29 '22 17:07 Strilanc

This was because of a floating point precision issue. Probably the string output is not including enough digits somehow.

Strilanc avatar Aug 22 '22 14:08 Strilanc

I have had issues in the past with std::stod and pythons float differing in their least significant decimal when called on the same string. Never fully unraveled why this was happening. Got around it by always comparing doubles up to some specified precision

danielbarter avatar Aug 29 '22 16:08 danielbarter