---
title: ExactReciprocal (v2.1)
description: API reference for qiskit.circuit.library.ExactReciprocal in qiskit v2.1
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/2.1/qiskit.circuit.library.ExactReciprocal
---

# ExactReciprocal

*class* `qiskit.circuit.library.ExactReciprocal(num_state_qubits, scaling, neg_vals=False, name='1/x')`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.1/qiskit/circuit/library/arithmetic/exact_reciprocal.py#L20-L52)

Bases: [`QuantumCircuit`](/docs/api/qiskit/2.1/qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.QuantumCircuit")

Exact reciprocal

$$
|x\rangle |0\rangle \mapsto \cos(1/x)|x\rangle|0\rangle + \sin(1/x)|x\rangle |1\rangle
$$

**Parameters**

- **num\_state\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int)) – The number of qubits representing the value to invert.
- **scaling** ([*float*](https://docs.python.org/3/library/functions.html#float)) – Scaling factor $s$ of the reciprocal function, i.e. to compute $s / x$.
- **neg\_vals** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) – Whether $x$ might represent negative values. In this case the first qubit is the sign, with $|1\rangle$ for negative and $|0\rangle$ for positive. For the negative case it is assumed that the remaining string represents $1 - x$. This is because $e^{-2 \pi i x} = e^{2 \pi i (1 - x)}$ for $x \in [0,1)$.
- **name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – The name of the object.

> **Note**
>
> It is assumed that the binary string $x$ represents a number \< 1.

## Attributes

### name

Type: `str`

A human-readable name for the circuit.

**Example**

```python
from qiskit import QuantumCircuit

qc = QuantumCircuit(2, 2, name="my_circuit")
print(qc.name)
```

```text
my_circuit
```
