Jump to content

Template:Csn2

From Meta, a Wikimedia project coordination wiki

Comma Separated Number with 2 digits after the decimal point (e.g. for cents, rounded)

Separates digits of an integer in groups of three; works for numbers under 1E12. Only positive numbers are supported, larger numbers are just reproduced.

Examples:
{{csn2|-1}} gives -1
{{csn2|-0}} gives 0.0-0
{{csn2|0.1}} gives 0.10
{{csn2|1.23}} gives 1.23
{{csn2|12.3}} gives 12.30
{{csn2|1.2345}} gives 1.23
{{csn2|12.345}} gives 12.35
{{csn2|0.994}} gives 0.99
{{csn2|0.995}} gives 1.00
{{csn2|6*20}} gives 120.00
{{csn2|1234}} gives 1,234.00
{{csn2|1230}} gives 1,230.00
{{csn2|1200}} gives 1,200.00
{{csn2|1000}} gives 1,000.00
{{csn2|0000}} gives 0.00
{{csn2|12345.67890123456}} gives 12,345.68
{{csn2|123456.7890123456}} gives 123,456.79
{{csn2|1234567.890123456}} gives 1,234,567.89
{{csn2|12345678.90123456}} gives 12,345,678.90
{{csn2|123456789.0123456}} gives 123,456,789.01
{{csn2|1234567890.123456}} gives 1,234,567,890.12
{{csn2|12345678901.23456}} gives 12,345,678,901.23
{{csn2|123456789012.3456}} gives 123,456,789,012.35
{{csn2|1234567890123.456}} gives 1234567890123.5
{{csn2|12345678901234.56}} gives 12345678901235
{{csn2|123456789012345.6}} gives 1.2345678901235E+14
{{csn2|1234567890123456.}} gives 1.2345678901235E+15
{{csn2|12}} gives 12.00
{{csn2|1234}} gives 1,234.00
{{csn2|123456}} gives 123,456.00
{{csn2|12345678}} gives 12,345,678.00
{{csn2|1234567890}} gives 1,234,567,890.00
{{csn2|123456789012}} gives 123,456,789,012.00
{{csn2|12345678901234}} gives 12345678901234

{{subst:csn2|87178291200|subst=subst:}} gives the wikitext 87,178,291,200.00.
{{csn2|1*2*3*4*5*6*7*8*9*10*11*12*13*14}} gives 87,178,291,200.00.