float_rounding

PlasmaCalcs.tools.math.float_rounding(x, prec=8)

round x to a more-likely-to-be-input float (if possible, else just return x).

[TODO] change this to work even if a decimal point appears inside the 0’s or 9’s.
Examples:
0.20000000001, prec=8 –> float(0.2)
35999999999.0, prec=8 –> float(36000000000)
35999999999.0, prec=12 –> unchanged (because prec > number of consecutive 0’s or 9’s)
0.12345678901234 –> unchanged (because no sequence of consecutive 0’s or 9’s)
prec: int
number of consecutive 0’s or 9’s required in str(x) before rounding.