Module:Roman/doc: Difference between revisions
Appearance
Content deleted Content added
oops meant to document sandbox version page—perhaps this is not possible |
m fix botched syntax for indented child list |
||
Line 4: | Line 4: | ||
This module implements the {{tl|Roman}} template. For behavioral documentation, please see the template page. For test cases, please see [[Template:Roman/testcases]]. |
This module implements the {{tl|Roman}} template. For behavioral documentation, please see the template page. For test cases, please see [[Template:Roman/testcases]]. |
||
* [[Module:Roman/ |
* '''[[Module:Roman/sandbox]]''' version pending discussion / protected edit: |
||
:* Supports two-way conversion—given MMXVIII will print 2018; given 2018 will print MMXVIII. |
|||
:* Converts argument containing Roman Numeral (IVX…) as conversion to [[Arabic Numerals]] (e.g. 2018) '''otherwise''' treated as conversion to [[Roman Numerals]] (e.g. MMXVIII). |
|||
:* Case or spacing within Roman Numeral argument make no difference. |
|||
* '''Current''' version |
|||
* Module supports 0 as a Roman numeral, displays as 'N'. |
:* Module supports 0 as a Roman numeral, displays as 'N'. |
||
* Prior to 25 April 2016, used to display 69105 as <span style="text-decoration:overline;">LXV</span>MMMMCV. With the addition of <span style="text-decoration:overline;">IX</span> and <span style="text-decoration:overline;">IV</span> being 9000 and 4000 respectively, we now display 69105 as <span style="text-decoration:overline;">LXIX</span>CV. |
:* Prior to 25 April 2016, used to display 69105 as <span style="text-decoration:overline;">LXV</span>MMMMCV. With the addition of <span style="text-decoration:overline;">IX</span> and <span style="text-decoration:overline;">IV</span> being 9000 and 4000 respectively, we now display 69105 as <span style="text-decoration:overline;">LXIX</span>CV. |
||
* Module handles decimal, fractional, and arithmetic expressions to a precision of 1/1728. {{green|Uses <code>#expr:</code> at line 118.}} |
:* Module handles decimal, fractional, and arithmetic expressions to a precision of 1/1728. {{green|Uses <code>#expr:</code> at line 118.}} |
||
==Handling tricky cases (like 0.00001 and 99.99999)== |
==Handling tricky cases (like 0.00001 and 99.99999)== |
Revision as of 19:19, 20 February 2018
![]() | This Lua module is used on 5,900+ pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
This module implements the {{Roman}} template. For behavioral documentation, please see the template page. For test cases, please see Template:Roman/testcases.
- Module:Roman/sandbox version pending discussion / protected edit:
- Supports two-way conversion—given MMXVIII will print 2018; given 2018 will print MMXVIII.
- Converts argument containing Roman Numeral (IVX…) as conversion to Arabic Numerals (e.g. 2018) otherwise treated as conversion to Roman Numerals (e.g. MMXVIII).
- Case or spacing within Roman Numeral argument make no difference.
- Current version
- Module supports 0 as a Roman numeral, displays as 'N'.
- Prior to 25 April 2016, used to display 69105 as LXVMMMMCV. With the addition of IX and IV being 9000 and 4000 respectively, we now display 69105 as LXIXCV.
- Module handles decimal, fractional, and arithmetic expressions to a precision of 1/1728. Uses
#expr:
at line 118.
Handling tricky cases (like 0.00001 and 99.99999)
- Find the Roman numerals for the integer part of the number.
- If the number is not an integer:
- Add half of the smallest unit (1/1728) to simulate rounding instead of truncation.
- Ensure this new result is between 1/1728 and 1727/1728. (actually 1.1/1728 and 1727.1/1728 due to floating point rounding issues)
- Hence, 0.00001 is guaranteed to have at least the smallest unit symbol (instead of being blank or 0), and 99.99999 does not display as 100 or 99 and 2 halves.
Validation
- Template:Roman/testcases
- Module:Roman/testcases - does not contain fractional/decimal tests
- The template supports subst: and safesubst:.