smpl.stat.round_sig

smpl.stat.round_sig(x, sig=2)[source]

Round to sig significant digits.

Parameters

xfloat

Value to round.

sigint

Number of significant digits.

Returns

float

Rounded value.

Examples

>>> round_sig(1.23456789, sig=2)
1.2
>>> round_sig(1.23456789, sig=4)
1.235