Forum:How do I format a number?

Wiki indicates that there is a function called formatnum that has the behavior of formatting numeric values. I have tried using this on my wiki (w:c:cafeworld:Template:CookbookLine) to no avail (as of the time that I write this forum request, I have removed the reference).

The example that media wiki shows is as follows:
 * result: 2 300,12
 * result: 2 300,12


 * result: 2,300.12
 * result: 2,300.12


 * result: 2,300.12
 * result: 2,300.12

But this does not appear to work at all. It would be very cool to have all the calculations within the template so that when we need to add new data we do not have to do all the calculations outside of the wiki. The calculations appear to work well; it is just that it would be good to have the formatting of the output numbers set (i.e. comma-separated thousands and two digits after the decimal point).

Is there a way to do this within wikia? Mrjoeterrace 23:39, May 21, 2010 (UTC)


 * It works fine; you just typed it wrong. You need to remove the pound (#) sign from your syntax:


 * 2,300.123
 * result: 2,300.123


 * —Lowellian (reply) 23:48, May 21, 2010 (UTC)
 * Okay, I added this to my wiki, but the floating numbers are still not right.
 * 0
 * result: 0


 * 0
 * result: 0


 * 0.333
 * result: 0.333


 * 0
 * result: 0


 * Mrjoeterrace 00:08, May 22, 2010 (UTC)


 * You're confusing the formatnum magic word (http://www.mediawiki.org/wiki/Help:Magic_words#Formatting) with the formatnum extension (http://www.mediawiki.org/wiki/Extension:FormatNum). What's available on Wikia is the formatnum magic word, which doesn't do anything except insert or remove group separators like commas. The formatnum extension, which does use the pound (#) syntax, is a third-party extension and not installed by default on Wikia, though you can request through w:c:cafeworld:Special:Contact that it be installed for the CafeWorld wiki.


 * —Lowellian (reply) 01:07, May 22, 2010 (UTC)