In python, I have a number: U = 0.02462631224438585 +- 3.350971888120506e-06
.
How do I round it to the correct significant figures due to the uncertainty being rounded to 1s.f.
?
Is there an easy way of using numpy
? Or scipy
or are the built-in function the best for this?
I've tried using set_printoptions(precision=3)
but this doesn't work.
I've also tried using round(number, significant - len(str(number)))
, but this seems long-winded.
I'm sure I have used a function that is simply a couple of years ago without having to create my own.
The final number should be U = 2.4626e-02 +- 3e-06
or U = (2.4626 +- 3e-4)e-02