tutorial confusing

this is what tutorial say

Start with: 42030
Slide decimal left 4 spaces: 4.2030e4
No leading zeros to trim: 4.2030e4
Trim trailing zeros: 4.203e4 (4 significant digits)

so one of quiz

146000

i assume it is

1.46e5

but it was wrong, it should be

1.46000e5 (3 significant digits). Remember, trailing zeros in a whole number with no decimal are not significant but are good for documentation.

why is it the example above removed one of zero and replace to e4.

Am I missing something?
trailing zeros in a whole number with no decimal are not significant but are good for documentation
This is relevant when you're communicating with people, to indicate precision. 1E+13 and 1.00000E+13 indicate the same value, but the latter explicitly states that the value is precise to at least 1 part per million, while the former only states what the first digit of the value is.

But a value in a computer program doesn't represent uncertainty, it represents one and only one value. 1.46E+5 and 1.46000E+5 are the exact same value.
@soulworld05,
You are right. The tutorial at learncpp, if that's what you used, is wrong.
146000 has only 3 significant figures while 146000. has 6 significant figures.
> but the latter explicitly states that the value is precise to at least 1 part per million
so they are significant
so they are significant
That's indeed true. Confusing precision with the machine (or piece of paper it's written on) has nothing to do with significant figures.

1000 on its own has one significant figure, while 1000. has 4. If you want that number to 2 significant figures then it is written as 1.0e2. i.e you have to resort to scientific notation because there is no other way of using the decimal point.
Topic archived. No new replies allowed.