36 lines
1.1 KiB
Plaintext
36 lines
1.1 KiB
Plaintext
---
|
||
title: apply_prefix
|
||
description: API reference for qiskit.utils.apply_prefix
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: function
|
||
python_api_name: qiskit.utils.apply_prefix
|
||
---
|
||
|
||
# qiskit.utils.apply\_prefix
|
||
|
||
<Function id="qiskit.utils.apply_prefix" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.21/qiskit/utils/units.py" signature="apply_prefix(value, unit)">
|
||
Given a SI unit prefix and value, apply the prefix to convert to standard SI unit.
|
||
|
||
**Parameters**
|
||
|
||
* **value** (`Union`\[`float`, [`ParameterExpression`](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression")]) – The number to apply prefix to.
|
||
* **unit** (`str`) – String prefix.
|
||
|
||
**Return type**
|
||
|
||
`float`
|
||
|
||
**Returns**
|
||
|
||
Converted value.
|
||
|
||
<Admonition title="Note" type="note">
|
||
This may induce tiny value error due to internal representation of float object. See [https://docs.python.org/3/tutorial/floatingpoint.html](https://docs.python.org/3/tutorial/floatingpoint.html) for details.
|
||
</Admonition>
|
||
|
||
**Raises**
|
||
|
||
**ValueError** – If the `units` aren’t recognized.
|
||
</Function>
|
||
|