Template:Quaternary
04
| This template uses Lua: |
The {{Quaternary}} template makes it easy to convert decimal numbers (base 10) into quaternary (base 4) and formats them according to a variety of common notations.
Usage
This template has one mandatory parameter: the decimal number that is to be converted to quaternary (represented below as n). It may be supplied as the first unnamed/positional parameter ({{Quaternary|n}}), or as the value of the named value ({{Quaternary|value=n}}) or 1 ({{Quaternary|1=n}}) parameters.
Basic examples
{{Quaternary|4632}}→ 10201204{{Quaternary|value=81681.25}}→ 103330101.14{{Quaternary|1=-51985}}→ -302301014
Formatting
This template also provides an optional second parameter which controls the formatting of the conversion output, with several § Notation keywords that correspond to various alternate notations for quaternary numbers other than the default subscripted Arabic numeral 4 (n4). The keywords may be defined as an unnamed/positional second parameter ({{Quaternary|n|formatting_keyword}}) or as the value of the named affix ({{Quaternary|n|affix=formatting_keyword}}) or 2 ({{Quaternary|n|2=formatting_keyword}}) parameters.
All three of the suffix notations, i.e. the default formatting, the quat and the Q keywords, provide the added benefit of displaying a tooltip that reads "quaternary number (base 4)" to further assist in identifying non-decimal numbers within dense prose content.
Notation keywords
- Suffixes:
- Default formatting (parameter empty or undefined/absent keyword): Subscripted serif 4 suffix (4)
{{Quaternary|4632}}→ 10201204
quat: Subscripted serif quat suffix (quat){{Quaternary|4632|quat}}→ 1020120quat
Q: Serif Q suffix (Q){{Quaternary|4632|Q}}→ 1020120Q
- Default formatting (parameter empty or undefined/absent keyword): Subscripted serif 4 suffix (4)
- Prefixes:
q: Lowercase q prefix (q){{Quaternary|4632|q}}→ q1020120
0q: Arabic numeral 0 with lowercase q prefix (0q){{Quaternary|4632|0q}}→ 0q1020120
digit/no/none: Unformatted output{{Quaternary|4632|none}}→ 1020120
TemplateData
TemplateData for Quaternary
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Decimal number | value1 | The number input to convert from decimal (base 10) to quaternary (base 4) | Number | required |
| Notation | affix2 | Select from a variety of common notations for quaternary values in lieu of the default subscripted 4
| Line | optional |