(x, n=3)
return np.round(x, -int(np.floor(np.log10(np.abs(x)))) + (n - 1))
Round a number x to n significant figures.
Round a number x to n significant figures.
Round a number x to n significant figures .
def _round_to_n_sig_figs(x, n=3):
    """Round a number x to n significant figures."""
    if n is None:
        return x
    if not x:
        return 0
    return np.round(x, -int(np.floor(np.log10(np.abs(x)))) + (n - 1))
def _round_to_n_sig_figs ( x , n = 3 ) : if n is None : return x if not x : return 0 return np . round ( x , - int ( np . floor ( np . log10 ( np . abs ( x ) ) ) ) + ( n - 1 ) )