# Return the precision of the first non zero digit in a number for measurement error representation function

I'd like to return the precision of the first non zero digit in a number. The motivation is so that I can quickly construct my error notation which is the bracketed notation, e.g. $$x = 1.234$$ with associated error $$\delta x = 0.0015$$ I would represent the measurement as $$1.23(2)$$. I want to automate this so I would:

• Determine the precision of the error -- round up by the next digit. So in pseudo code:

DeltaX = 0.0015 DeterminePrecissionValue[DeltaX] (*Would return: 3*) NumberForm[Numb, {DeltaX, 3}] NumberForm[Numb, {X, 3}]

• Based on the above result I would then round the measurement value to the precision of the error result and then format accordingly.

• That precision can be obtained using the base 10 log, e.g. In[72]:= Ceiling[-Log[10, .0015]] Out[72]= 3 – Daniel Lichtblau Dec 30 '18 at 17:24
• Elementary mathematics comes to the rescue again. Thanks @DanielLichtblau! – Q.P. Dec 30 '18 at 19:25