Skip to content

Upgrade float to double in cirq protos #3116

@jaeyoo

Description

@jaeyoo

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 (#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.
  }

Metadata

Metadata

Assignees

Labels

area/googlecomplexity/mediumintroduces/modifies 3-5 concepts, takes max up to a month for an advanced contributorkind/feature-requestDescribes new functionalitytriage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions