Upgrade float to double in cirq protos
See original GitHub issueHi, 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:
- Created 3 years ago
- Comments:15 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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.