pyqpanda.Visualization.pi_check
Check if number close to values of PI
Functions
|
Determines if a given number is nearly an integer multiple or fraction of π. |
Module Contents
- pyqpanda.Visualization.pi_check.pi_check(inpt, eps=1e-06, output='text', ndigits=5)[源代码]
Determines if a given number is nearly an integer multiple or fraction of π. Provides a string representation based on the specified output format.
- Args:
- inpt (float):
The number to be checked.
- eps (float):
The tolerance for comparison, defaulting to 1e-6.
- output (str):
The format of the output. Options are 'text', 'latex', 'mpl', 'qasm'.
- ndigits (int):
The number of significant digits to display in the output, if applicable.
- Returns:
- str:
A string that represents whether the input is close to an integer multiple or fraction of π.
- Raises:
- ValueError:
If the input is not a number or a valid string representation of a number.
- TypeError:
If an invalid type is passed to the function.
- QError:
If the output format is not one of the supported options ('text', 'latex', 'mpl', 'qasm').