This is a documentation subpage for Template:Precision (see that page for the template itself).
It contains usage information, categories and other content that is not part of the original template page.

Given a decimal value, return the precision, as an integer of the number of digits past the decimal point. Negative numbers are returned for precision left of the decimal point.

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}} 9
{{Precision|1111.12345678}} 8
{{Precision|1111.1234567}} 7
{{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


Community content is available under CC-BY-SA unless otherwise noted.