question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrade float to double in cirq protos

See original GitHub issue

Hi, I am suffering from the precision issue due to google protobuf.

In fact, google protobuf float is float32, and double is float64. However, python uses float only for float64, and this makes discrepancy when I saved into protobuf and reload the circuit from the proto. As it happens to others (https://github.com/quantumlib/Cirq/issues/2728, for example) I suggest that upgrading the float to double in cirq protos.

For example, https://github.com/quantumlib/Cirq/blob/master/cirq/google/api/v2/program.proto#L146

float float_value = 1; # -> double float_value = 1;

OR at least, I hope to have double_value as one of the variables,

https://github.com/quantumlib/Cirq/blob/master/cirq/google/api/v2/program.proto#L145-L149

oneof arg_value {
    float float_value = 1;
    RepeatedBoolean bool_values = 2;
    string string_value = 3;
    double double_value = 4; # <- like this.
  }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dstrain115commented, Jan 28, 2022

Not urgent, but while you are in the protos, can you check this issue, @verult ? I believe that this has been done and that the resulting (deprecated) fields can be removed, but this could use a bit of verification, since I haven’t touched this in a while.

1reaction
dstrain115commented, Jul 10, 2020

I’ve run into this before when serializing into FSIM_GATESET and then deserializing on the other side, since it wants to check if exponent is close to, say pi/6, and it is only within 1e-6 instead 1e-8 due to the down-scaling to 32 bit precision.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrading float fields to double - Google Groups
If you change float to double, in the case of old data and new parser, the parser will take the additional 4 bytes...
Read more >
Untitled
9th planet discovered nasa, Double front doors with wrought iron. ... Coreldraw x3 upgrade, Lampada png, Dexter marine axle, Chapter 4 of luke's...
Read more >
FiGoal 4 Pack Summer Swimming Float with Watermelon ...
Buy FiGoal 4 Pack Summer Swimming Float with Watermelon, Lime, Orange and Semi ... Fun Floats Accessories, New Upgrade - Adding Two Styles...
Read more >
Untitled
Ios upgrade ipad 1, Paul reubens nice dreams, The bullet vanishes trailer ita, ... Que es un vaso sanguineo, Newlib nano printf float,...
Read more >
When is it beneficial to convert from float to double via decimal
If the double(a) is closer to the original than the double(b), I increment pro-direct conversion counter, in the opposite case I increment the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found