In python you have round(number, digits)
.
I have numbers like
0.123525,
0.01346346,
0.0078236346,
3.43568
...
My goal is for round
to round up to the first digit that is not zero
ie
0.1
0.01
0.008
3
...
My pseudocode-approach:
convert double to string
for each literal in string check whether it's zero
once it's not, count digits
use digits for digits in round.
Is there a ready made function or an elegant approach?