# Return number of significant figures

This topic is 7583 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

I have a number field. I have another (calc) field which should return the number of significant figures in the number field. Right now, I count the length of the field and substract any zeroes or decimals. It works great unless I have a number like 0.00980 in the field; the final "0" is significant, but alas my calculation fails! Any ideas on how to trap for a final zero? Or perhaps there is a more elegant approach than my sledgehammer one!

Thanks!

##### Share on other sites

Are you looking for just the significant digits or a set number of significant digits? You seem to be at cross puproses here.

The number 0.00980 The final zero is NOT significant. So if you want it, then you need to make your field 5 digits to the right of the decimal point and tell it to fill in the blanks with zeros. Of course that would mean that a number like 1.0 would read 1.00000.

##### Share on other sites

The numbers vary in length and size. Final zeroes are always be signficant for this particular purpose.

##### Share on other sites

The problem is that you must define the number field as a text field. Otherwise, as soon as you try to use the value in a text calculation, the last zeroes will be lost. With the number field defined as text, you can use this formula to get the number of digits to the right of the decimal:

Max(Length(NumberField)-Position(NumberField&".",".",1,1),0)

PS. There's no disadvantage to defining the field as text. You can still do numeric calculations with it.

##### Share on other sites

Is that African Gray? Nice

##### Share on other sites

Yes, you are absolutely correct - and I already had this defined as a text field! I should have mentioned it in my original post.

I'd been counting the number of zeroes and the decimal and subtracting that from the length, and of course this didn't count any final zeroes.

It didn't occur to me to use the max function, I will try out your calc and see how it works! Thanks!

##### Share on other sites

Anatoli, that is indeed an African grey. Her name is Kianga, Swahili for "little light". She is 12 this year and I've had her since she was 7 weeks old. This March she surprised me by laying two eggs and then trying to hatch them (she doesn't, alas, have a boyfriend, but this didn't diminish her determination a bit). More info than you wanted, I'm sure, but there you go.

##### Share on other sites

This topic is 7583 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account