How many Sig figs has 000,000

How many sig figs in a double?

As we all know, floating point cannot accurately represent most numbers. I am not asked a question about the precision of swimmers or doubles.

In a program, floating point numbers “come from somewhere”. Some could arise from an integer that others promote as number literals.

Of course, some floating point numbers come from calculations on other numbers.

In my problem, I sometimes read scores from a text file, and other times, I get it from a complex function that I must treat as a black box in floating. The creator of the text file can choose as many great people as they want - they could use just three, or maybe eight.

I will then do some calculations on these numbers, and I would like to know how many significant figures were hinted at when they were created.

For argument, consider that I am performing an adaptive piecewise least squares fit on the input points. I will continue to divide my segments piece by piece until a certain tolerance is reached. I want to (partially) base the tolerance on the essential numbers of the data entry - does not match 10 ^ -8 when the data is rounded down to the nearest 10 ^ -3.

Others (below) have similar questions (but not quite the same). For example, I'm not particularly concerned with a representation given to the user in a pretty form. I am not particularly recovered from a source value with the same floating point representation.

How to calculate the number of significant decimal places of a c ++ double?

How can I test how many significant figures a swimmer has in C ++?

I like to calculate the sig fig purely on the value of the double itself. I don't want to do a bunch of word processing on the original data file.

In most cases, floating point numbers will end with a large series of 0000000 or 99999999 in the middle of them. One intuitive problem is that I'm interested in figuring out where the repetition 0 or 9 sequence starts. However, I would rather not do this conversion approach with a looped rounded string. I am hoping for a fairly straightforward and efficient way of finding out.

Maybe something as simple as looking for the 'one' bit least significant and then figuring out its size?