Difference between revisions of "Template:Precision"

From MidsouthMakers - Memphis Area Hackerpace
Jump to navigation Jump to search
m (1 revision)
 
(No difference)

Latest revision as of 17:53, 18 January 2010

[edit] [purge] Template documentation

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

ja:Template:Precision ka:თარგი:Precision pt:Predefinição:Precision