Template:Len
From Meta, a Wikimedia project coordination wiki
This template determines the number of digits before the decimal point excluding leading zeros in non-negative numbers with a maximum of 15. It's designed to be used in template development, its code should be substituted inline.
- Result -1: Value < 0, error. Non-negative numbers incl. 0 yield at least 0.
- Result 0: Value < 1 (10^0), negative exponents like -2 for 0.01 not supported.
- Result 1: Value < 10 (10^1), especially 1 up to 9.
- Result 2: Value < 100 (10^2), especially 10 up to 99.
- Result 3: Value < 1000 (10^3), especially 100 up to 999.
- Result 15: Value < 10^15
- Result 16: 10^15 <= value, see accuracy.
- Examples:
- {{
Len|-.1}} = -1 - {{
Len|0.0}} = 0 - {{
Len|+.1}} = 0 - {{
Len|1.0}} = 1 - {{
Len|123}} = 3 - {{
Len|0123}} = 3 - {{
Len|7*3}} = 2 - {{
Len|20091203210243}} = 14 (timestamp) - {{
Len|1234567890.234567}} = 10 - {{
Len|123456789012345.7}} = 15 - {{
Len|1234567890123456.}} = 16 (out of range) - {{
Len|12345678901234567}} = 16 (out of range)