Content deleted Content added
No edit summary |
→Sort key: new section explaining the sort key |
||
Line 29:
Apart from the added thousands separators the numbers are formatted as supplied (scientific notation or not, leading and trailing zeros, and a zero before the decimal point or not). This formatting does not affect the sorted order except for numbers not satisfying the limitations mentioned below.
==Sort key==
The sort key is a nineteen-digit number. For numbers within range the first four digits are determined by the number's sign and [[order of magnitude]] and the next fifteen digits are determined by the number's sign and [[significand]].
;Numbers within range
*For numbers between 10<sup>−308</sup> and 10<sup>308</sup> the first four digits are calculated by adding 7000 to the order of magnitude and the next fifteen digits are calculated by multiplying the significand by 10<sup>14</sup>.
*For numbers between −10<sup>−308</sup> and −10<sup>308</sup> the first four digits are calculated by subtracting the order of magnitude from 2999 and the next fifteen digits are calculated by subtracting the significand from 10 multiplying the difference by 10<sup>14</sup>.
*The sort key for 0 is 5000000000000000000.
;Numbers out of range
*Numbers larger than 10<sup>308</sup> are assigned the sort key 9000000000000000000.
*Numbers smaller than −10<sup>308</sup> are assigned the sort key 1000000000000000000.
*Numbers between 10<sup>−308</sup> and 0 or between 0 and −10<sup>−308</sup> are assigned the sort key 5000000000000000000.
==Limitations==
*Any subset of numbers larger than 10<sup>308</sup> are sorted together
*Any subset of numbers smaller than −10<sup>308</sup> are sorted together
*Any subset of numbers between 10<sup>−308</sup> and −10<sup>−308</sup> are sorted together
*If a non-numeric value is given as the first unnamed parameter the results are undefined.
*The hyphen minus sign is converted into a true minus sign; note, though, that this means no more than 12 significant figures are possible.
|