text: Title: Optimizer failure
  Body: **Description of the issue**
  The `optimize_for_target_gateset` crashes when trying to optimize XXPowGate with larger global shift value. The optimizer crashes with division by zero error.
  
  
  **How to reproduce the issue**
  
  ```
  import cirq as c
  qubits = c.LineQubit.range(4)
  circuit = c.Circuit()
  circuit.append(c.rz(-0.0171*np.pi)(qubits[0]))
  circuit.append(c.CNOT(qubits[3], qubits[1]))
  circuit.append(c.MSGate(rads=-0.01*np.pi)(qubits[0], qubits[1]))
  circuit.append(c.Y(qubits[0]))
  circuit.append(c.CSWAP(qubits[2], qubits[0], qubits[3]))
  circuit.append(c.Ry(rads=0.014*np.pi)(qubits[2]))
  circuit.append(c.Z(qubits[3]))
  circuit.append(c.ISWAP(qubits[0], qubits[2]))
  circuit.append(c.XX(qubits[1], qubits[3]))
  circuit.append(c.XXPowGate(exponent=0.26, global_shift=100000)(qubits[2], qubits[3]))
  circuit.append(c.ISWAP(qubits[0], qubits[2]))
  circuit.append(c.Ry(rads=-0.042*np.pi)(qubits[3]))
  
  
  
  print(circuit)
  optimized = c.optimize_for_target_gateset(circuit, gateset = cg.SycamoreTargetGateset())
  print(optimized)
  
  ```
  
  <details>
  
  ```bash
                                                        ┌───────┐
  0: ───Rz(-0.017π)───MS(-0.01π)───Y───×─────────────────iSwap────────────────iSwap─────────
                      │                │                 │                    │
  1: ───X─────────────MS(-0.01π)───────┼─────────────────┼────XX──────────────┼─────────────
        │                              │                 │    │               │
  2: ───┼──────────────────────────────@───Ry(0.014π)────iSwap┼─────XX────────iSwap─────────
        │                              │                      │     │
  3: ───@──────────────────────────────×───Z──────────────────XX────XX^0.26───Ry(-0.042π)───
                                                        └───────┘
  Traceback (most recent call last):
    File "/Users/xxx/xxx/cirq_diverging_sycamore.py", line 36, in <module>
      optimized = c.optimize_for_target_gateset(circuit, gateset = cg.SycamoreTargetGateset())
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/transformers/transformer_api.py", line 379, in func_with_logging
      return _transform_and_log(
             ^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/transformers/transformer_api.py", line 438, in _transform_and_log
      transformed_circuit = _run_transformer_on_circuit(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/transformers/transformer_api.py", line 424, in _run_transformer_on_circuit
      return func(mutable_circuit if mutable_circuit else circuit, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/transformers/optimize_for_target_gateset.py", line 150, in optimize_for_target_gateset
      circuit = transformer(circuit, context=context)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/transformers/target_gatesets/compilation_target_gateset.py", line 71, in transformer_with_kwargs
      return transformer(circuit, context=context, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/transformers/transformer_api.py", line 379, in func_with_logging
      return _transform_and_log(
             ^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/transformers/transformer_api.py", line 438, in _transform_and_log
      transformed_circuit = _run_transformer_on_circuit(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/transformers/transformer_api.py", line 424, in _run_transformer_on_circuit
      return func(mutable_circuit if mutable_circuit else circuit, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq_google/transformers/target_gatesets/sycamore_gateset.py", line 75, in merge_swap_rzz_and_2q_unitaries
      circuit = cirq.merge_operations_to_circuit_op(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/transformers/transformer_primitives.py", line 566, in merge_operations_to_circuit_op
      return merge_operations(circuit, merge_func, tags_to_ignore=tags_to_ignore, deep=deep)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/transformers/transformer_primitives.py", line 505, in merge_operations
      merged_circuit.add_op_to_moment(moment_idx, op)
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/transformers/transformer_primitives.py", line 345, in add_op_to_moment
      self.ops_by_index[moment_index][op] = 0
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/_compat.py", line 104, in wrapped_no_args
      result = func(self)
               ^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/value/value_equality_attr.py", line 90, in _value_equality_hash
      return hash((self._value_equality_values_cls_(), self._value_equality_values_()))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/_compat.py", line 104, in wrapped_no_args
      result = func(self)
               ^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/value/value_equality_attr.py", line 90, in _value_equality_hash
      return hash((self._value_equality_values_cls_(), self._value_equality_values_()))
                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/_compat.py", line 104, in wrapped_no_args
      result = func(self)
               ^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/_compat.py", line 104, in wrapped_no_args
      result = func(self)
               ^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/ops/eigen_gate.py", line 319, in _value_equality_values_
      return self._canonical_exponent, self._global_shift
             ^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/ops/eigen_gate.py", line 311, in _canonical_exponent
      period = self._period()
               ^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/ops/eigen_gate.py", line 300, in _period
      return _approximate_common_period(real_periods)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/ops/eigen_gate.py", line 443, in _approximate_common_period
      common = float(_common_rational_period(approx_rational_periods))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/ops/eigen_gate.py", line 461, in _common_rational_period
      int_common_period = _lcm(int_periods)
                          ^^^^^^^^^^^^^^^^^
    File "/Users/xxx/xxx/cirqenv/lib/python3.11/site-packages/cirq/ops/eigen_gate.py", line 402, in _lcm
      t = t * r // math.gcd(t, r)
          ~~~~~~^^~~~~~~~~~~~~~~~
  ZeroDivisionError: integer division or modulo by zero
  ```
  
  </details>
  
  **Cirq version**: 1.4.1
  
  