Mabinogi World Wiki is brought to you by Coty C., 808idiotz, our other patrons, and contributors like you!!

Want to make the wiki better? Contribute towards getting larger projects done on our Patreon!

NOTICE: Seems like daily VIP shadow missions may be wrong occasionally!!

I'm blocking like thousands of bot accounts so if you were accidentally banned please get on the Discord and ping Kadalyn!

# Template:Fns

**Forced Numerical Sorting (Fns)**

*For a template that shows the hidden sort key see Template:UFns.*

This template takes an unformatted number as input and returns a hidden sort key followed by a displayed, formatted and rounded off integer of the inputted number. The resulting displayed integer (but not the sort key) will have commas for thousand seperators added. Any hyphen used as a negative sign in front of the inputted number is converted into a true negative sign (which is easier to see) but only in front of the resulting displayed integer. The template can be used to input a number which is to be part of some data consisting of at least that number (rounded to the nearest integer) and possibly having non-numerical characters *trailing* it. When the data is added to a sortable list or table column then the hidden sort key can be used to force a numerical sort where otherwise an alphabetical sort will occur. For example, using "{{Fns|9000}}" or "{{Fns|9000}}text" works but using "{{Fns|9000text}}" will produce an error message and using "text{{Fns|9000}}" will not sort correctly (unless the "text", in front of the number, is exactly the same for each data in the sortable list or table column).

**Note: **

- A real number, or an equation resulting in a real number, can be entered into this template but they will be rounded off to the nearest whole number (i.e., an integer will still be used to generate the result). The same hidden sort key will be generated whether the inputted number is an integer or a real number rounded off to the same integer. Similarly the resulting displayed integer will be the same whether the inputted number is an integer or a real number that will round off to the same integer.
- The result of this template is a text string and using that result as the input into an expression or template that requires an integer or real number will produce an error message.

**Usage:**

{{Fns|unformatted number}}

- Where the
*unformatted number*is an integer or real number (with a positive, a negative or no sign) without any commas as thousand seperators. - Using "{{Fns}}" will result in a " 0", as that is the default result for this template.
- Using "{{Fns|}}" will result in an error message.
- Examples:
- "{{Fns|12345678}}" will produce a
*hidden*sort key of "000012345678&" followed by the*displayed*, formatted integer " 12,345,678". - "{{Fns|-12345678}}" will produce a
*hidden*sort key of "-999987654321&" followed by the*displayed*, formatted integer " −12,345,678". - "{{Fns|12345678.901}}" will produce a
*hidden*sort key of "000012345679&" followed by the*displayed*, formatted integer " 12,345,679". - "{{Fns|12345678.201}}" will produce a
*hidden*sort key of "000012345678&" followed by the*displayed*, formatted integer " 12,345,678" (this result is exactly the same as that of the first example given above, the inputted real number in this example has been rounded down to the same integer inputted in the first example).

- "{{Fns|12345678}}" will produce a

**Input:**

- This template will not accept numbers given in scientific notation, e.g., "1.23E+09".
- This template will accept integers with up to 12 digits and real numbers with up to 12 digits before the decimal point (any real number with digits after the decimal point will be rounded off to the nearest integer), e.g., "123456789012" and "123456789012.123" will both give
**Don't input a number > 999999999999 or < −999999999999!**".
123,456,789,012. Numbers greater than "999999999999" and less than "-999999999999" will result in an error message, e.g., "{{Fns|1234567890123}}" will result in this error message " - Except for using a positive sign (only in front of a number), a hyphen as a negative sign (only in front of a number) or a single decimal point (anywhere in a number), only the digits from 0 to 9 can be part of a number used by this template. For example, inputting "+1236.565", "50", "0.65" and "-9656000" into this template will result in, respectively, " 1,237", " 50", " 1" and " −9,656,000" but inputting "+1,236.565", "50g", "0.65%" and "-9,656,000" will result in an error message.
- Mathematical equations and conditional statements that are supported for expressions, on Mabinogi World Wiki, may be inputted into this template, with or without being included in an expression. A mathematical equation, conditional statement or expression that is inputted into this template will be calculated first, then the result rounded off to the nearest integer and then converted.
- Examples;
- "{{Fns|-1235.786*100}}" results in " −123,579", note that "{{#expr:-1235.786*100}}" results in "-123578.6".
- "{{Fns|{{#expr:-1235.786*100}}}}" results in " −123,579", note that "{{#expr:{{#expr:-1235.786*100}}}}" results in "-123578.6".
- "{{Fns|-1235.786round2}}" results in " −1,236", note that "{{#expr:-1235.786round2}}" results in "-1235.79".
- "{{Fns|(10<5)+19.85}}" results in " 20", note that "{{#expr:(10<5)+19.85}}" results in "19.85".
- "{{Fns|(10>5)+19.85}}" results in " 21", note that "{{#expr:(10>5)+19.85}}" results in "20.85".

- Examples;

**Related Information About Mabinogi World Wiki:**

The term expression is used here to mean a mathematical equation requiring the input of one or more numbers (integers and/or real) that results in a number (integer or real). Inputted numbers with non-significant leading zeroes to the left of the decimal point and/or non-significant trailing zeroes to the right of the decimal point will be treated as if those non-significant zeroes did not exist (e.g., "00001003.0405000" will be treated as if it had been entered as "1003.0405").

- Numbers calculated by an expression used on Mabinogi World Wiki, that give results between "−0.001" and "0.001" (excluding zero), will probably be given in scientific notation, e.g., "{{#expr:1/100000}}" is not given as "0.00001" but as "1.0E-5". The actual trigger for when scientific notation is used does not appear to be clear cut, e.g., "{{#expr:1/10000}}" is usually given as "0.0001" but ocassionally is given as "1.0E-4". However, numbers from "−1" to "−0.001" and "0.001" to "1", never appear to be given as scientific notation. Remember, that this template, or any expression used on Mabinogi World Wiki, will not accept numbers in scientific notation.
- A number outputted by an expression used on Mabinogi World Wiki, will be rounded off to the first 12 digits, e.g., "{{#expr:12345678901234.123*1}}" will result in "12345678901234".
- Any large enough number outputted from an expression on Mabinogi World Wiki will give the result in scientific notation (and rounded to the first 12 digits), e.g., "{{#expr:123456789012345678901234.123*1}}" will output "1.2345678901235E+23". Remember, that this template, or any expression used on Mabinogi World Wiki, will not accept numbers in scientific notation.

**Code:**

{{ #ifexpr: ( ( ( {{{1|0}}} ) round 0 ) > 999999999999 ) or ( ( ( {{{1|0}}} ) round 0 ) < -999999999999 ) | '''<font color="red">Don't input a number > 999999999999 or < −999999999999!</font>''' | {{ #ifexpr: ( ( {{{1|0}}} ) round 0 ) = 0 | <span style="display:none"> {{ padleft: 0 | 12 | 0 }} & </span> 0 | {{ #ifexpr: ( ( {{{1|0}}} ) round 0 ) < 0 | <span style="display:none"> - {{ padleft: {{ #expr: 999999999999 + ( ( {{{1|0}}} ) round 0 ) }} | 12 | 0 }} & </span> − {{ formatnum: {{ #expr: -( ( {{{1|0}}} ) round 0 ) }} }} | <span style="display:none"> {{ padleft: {{ #expr: ( ( {{{1|0}}} ) round 0 ) }} | 12 | 0 }} & </span> {{ formatnum: {{ #expr: ( ( {{{1|0}}} ) round 0 ) }} }} }} }} }}