qiskit-documentation/docs/api/qiskit/0.36/qiskit.utils.apply_prefix.mdx

36 lines
1.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
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.20/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`]) 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` arent recognized.
</Function>