sig_figs
- postprocessinglib.utilities._helper_functions.sig_figs(x: float, precision: int) float
Rounds a number to number of significant figures as specified by the precision
- Parameters:
x (float) – the number to be rounded
precision (int) – the number of significant figures
- Returns:
the number rounded to the requested significant figures
- Return type:
float
Example
>>> from postprocessinglib.utilities import _helper_functions >>> number = 1.2342443 >>> rounded_number = _helper_functions.sig_figs(number, 3) >>> print(rounded_number) 1.23