qspec logo qspec logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qspec. round_to_n  (  x ,  n  )[source]

Round a value to n significant decimal places.

Parameters:
xscalar

The input data.

nint_like

The number of significant decimal places to round to.

Returns:
(x_round, decimals)tuple[float, int]

x rounded to n significant decimal places and the corresponding number of decimal places after the decimal point.

Raises:
TypeError

If x is not a scalar.