42 lines
1.2 KiB
Plaintext
42 lines
1.2 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
|
||
---
|
||
|
||
<span id="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.24/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** (*float |* [*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression")) – The number to apply prefix to.
|
||
* **unit** (*str*) – String prefix.
|
||
|
||
**Returns**
|
||
|
||
Converted value.
|
||
|
||
**Return type**
|
||
|
||
float
|
||
|
||
<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.
|
||
|
||
**Return type**
|
||
|
||
float
|
||
</Function>
|
||
|