It's correct, but it's not shown to three significant digits.
Hi shg
I have a different interpretation on this issue.
As I understand the number has only 2 significant digits, it's not possible to show more because there are no more.
The way I see it, a significant digit carries meaning. Since the number I'm given is 0.12 I don't have any idea of what the next digit is. It may be a 0 but also a 1,2,etc.
It seems from the examples that the values are number values. This means we don't have significant trailing zeros in the decimals unless we are told beforehand what's the precision.
If the input values were text values with all digits significant, then we could have significant trailing zeros.
Ex. If we are measuring something, 0.12 and 0.120 may not be the same thing. In the case of 0.12 it may mean that we are measuring with some instrument that has a 1/100 precision, we have no idea of what the next digit will be. In the case of the 0.120 it may mean that we are measuring with some instrument that has a 1/1000 precision, the trailing zero carries as much meaning as the 1 or the 2, it says that the thousands digit is really 0.
I hope the OP clarifies this issue.
- is there a fixed precision for the values?
- are the input values number values?
- is it really significant digits we want, or, is it the number in a format that includes 3 digits after the first significant digit, even if it's necessary to pad the result with non-significant 0's.