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!!

# User:ZRoc/n

## Contents

## About This Page

This page is a sub-page of my user page and is used by me to test templates, set up examples and generally mess around with stuff.

**IMPORTANT**: Please don't edit this page without talking to me first. Leave messages on User_talk:ZRoc rather than on this page's talk/discussion page, as it doesn't automatically tell me if this page gets new messages.

For other sub-pages see the list on my user page.

## Users With Permission to Edit This Page

- None

## Users Never Permitted to Edit This Page

## Description

This template is attempting to generate a hidden sort key for real numbers which have at least one non-zero digit after the decimal point. See User:ZRoc/Nts for a template with the sort key displayed.

Usage:

{{User:ZRoc/n|unformatted_number|rounding_number}}

The real number is entered as the 1st parameter (*unformatted_number*) and the 2nd parameter (*rounding_number*) is an integer which decides how many digits after the decimal point the real number is to be rounded off (this also determines the hidden sort key that is used). The rounding number should be for the maximum desired number of digits after the decimal point, for all the numbers to be sorted in a table's column and should remain the same for all those numbers. The reason the 2nd parameter is variable is that different tables may require a different number of digits before and after the decimal point.

Note that a number outputted by this template (or any expression) on Mabinogi World Wiki (MWW) will be rounded off to the first 12 consecutive digits, excluding leading or trailing zeros. Therefore, any number with more than 12 consecutive digits will produce the same sort key. Also, this template will not accept numbers with more than 12 digits before the decimal point, excluding leading zeros, however, it is doubtful MWW would require numbers larger than this. Obviously, the maximum number of digits preceding the decimal point will limit the maximum number of digits following the decimal point that a sort key can be outputted for, e.g., excluding leading or trailing zeros (note that, if possible, the rounding number can be set lower than the maximum allowed digits following a decimal point);

- largest expected real number has 12 digits preceding decimal point and therefore maximum digits allowed to follow decimal point = 0 (not worth using this template, it's an integer, use Template:Fns, e.g., 123456789012, 999999999999, 1234)
- largest expected real number has 11 digits preceding decimal point and therefore maximum digits allowed to follow decimal point = 1 (produces a very limited range of numbers to sort and would be doubtful if it was really useful, e.g., 12345678901.2, 99999999999.9)
- largest expected real number has 10 digits preceding decimal point and therefore maximum digits allowed to follow decimal point = 2 (this template can be useful but range of numbers to be sorted would still be limited, e.g., 1234567890.12, 1234567890.1, 1234.56, 1234, 1234.5, 9999999999.99)
- largest expected real number has 9 digits preceding decimal point and therefore maximum digits allowed to follow decimal point = 3 (this template can be useful, e.g., 123456789.012, 123456789.1, 1234.567, 1234.56, 1234, 999999999.999)
- ...etc...
- largest expected real number has 6 digits preceding decimal point and therefore maximum digits allowed to follow decimal point = 6 (this template can be useful)
- ...etc...
- largest expected real number has 1 digits preceding decimal point and therefore maximum digits allowed to follow decimal point = 11 (this template can be useful but that's a really restricted set of numbers that need sorting and it's doubtful that data from MWW would need such accuracy)
- largest expected real number is a 0 preceding decimal point and therefore maximum digits allowed to follow decimal point = 12 (this template can be useful but that's a really restricted set of numbers that need sorting and it's doubtful that MWW would need such accuracy)

Any number with only a zero before the decimal point and has more than 3 zeros immediately after the decimal point will be given in scientific notation (e.g., 0.00001 will be outputted as 1.0E-5), however, the hidden sort key will still sort the number correctly. On the other hand numbers from 0.1 to 1, 0.01 to 0.1 and 0.001 to 0.01 will not be outputted in scientific notation. The numbers from 0.0001 to 0.001 are a grey area, they are not usually outputted in scientific notation but occasionaly they may be. As far as I know, this is due to the wiki's software and the server running MWW, it happens to any expression used on this wiki to calculate a numerical result.

**Things to do:**

- An error check exists for numbers with more than 12 digits preceding a decimal point, excluding leading zeros, for the first parameter but needs another error check for the second parameter to limit it to be between 1 and 12.

**Note: **If the numbers in a table requiring a sort key are all going to be integers then use Template:Fns. Also, use Template:UFns to see what hidden sort keys are generated by Template:Fns.

Below is a copy of the code so far created on this page:

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