Template:Precision/sandbox/doc

From Mises Wiki, the global repository of classical-liberal thought
Jump to: navigation, search

For a number in ordinary decimal notation with a decimal point, this template determines the number of digits after the point. It is a measure for the precision implied by the notation.

For multiples of non-negative powers of 10 the negative of the exponent is returned. Note however that zeros do not necessarily indicate precision, a precise number can happen to be a multiple of a power of 10.

Note that floating point values have a maximum number of digits total, so 1111111111.11111111 is equivalent to 1111111111.1111111 (one less digit after decimal point), so the output of {{precision}} for both of those is 7.

Examples

{{Precision|1111.123456789}} Expression error: Unrecognized punctuation character "[".
{{Precision|1111.12345678}} Expression error: Unrecognized punctuation character "[".
{{Precision|1111.1234567}} Expression error: Unrecognized punctuation character "[".
{{Precision|1111.123456}} 6
{{Precision|1111.12345}} 5
{{Precision|1111111111.12345678}} 5
{{Precision|1111111111.1234567}} 5
{{Precision|1111111111.123456}} 5
{{Precision|1111111111.12345}} 5
{{Precision|1111111111.1234}} 4
{{Precision|1111111111.123}} 3
{{Precision|1111111111.12}} 2
{{Precision|1111111111.1}} 1
{{Precision|1111111111.10}} 2
{{Precision|1111111111.100}} 3
{{Precision|1111111111.1000}} 4
{{Precision|1111111111.10000}} 5
{{Precision|1111111111}} 0
{{Precision|1111111110}} -1
{{Precision|1111111100}} -2
{{Precision|1111111000}} -3
{{Precision|1111110000}} -4
{{Precision|1111100000}} -5
{{Precision|1111000000}} -6
{{Precision|1110000000}} -7
{{Precision|1100000000}} -8

See also