Template:Octal/doc
| This is a documentation subpage for Template:Octal. It may contain usage information, categories and other content that is not part of the original template page. |
| This template uses Lua: |
The {{Octal}} template makes it easy to convert decimal numbers (base 10) into octal (base 8) and formats them according to a variety of common notations.
Usage
[edit]This template has one mandatory parameter: the decimal number that is to be converted to octal (represented below as n). It may be supplied as the first unnamed/positional parameter ({{Octal|n}}), or as the value of the named value ({{Octal|value=n}}) or 1 ({{Octal|1=n}}) parameters.
| Numbers outside the range of -9,007,199,254,740,992 to 9,007,199,254,740,992 may be converted with reduced precision. |
Basic examples
[edit]Formatting
[edit]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 octal numbers other than the default subscripted Arabic numeral 8 (n8). The keywords may be defined as an unnamed/positional second parameter ({{Octal|n|formatting_keyword}}) or as the value of the named affix ({{Octal|n|affix=formatting_keyword}}) or 2 ({{Octal|n|2=formatting_keyword}}) parameters.
Both of the suffix notations, i.e. the default formatting and the oct keyword, provide the added benefit of displaying a tooltip that reads "octal number (base 8)" to further assist in identifying non-decimal numbers within dense prose content.
Notation keywords
[edit]- Default formatting (parameter empty or undefined/absent keyword): Subscripted serif 8 suffix (8)
{{Octal|4632}}→ 110308
oct: Subscripted serif oct suffix (oct){{Octal|4632|oct}}→ 11030oct
o: Lowercase o prefix (o){{Octal|4632|o}}→ o11030
0o: Arabic numeral 0 with lowercase o prefix (0o){{Octal|4632|0o}}→ 0o11030
\/backslash/bs/revsol/rs: Reverse solidus (backslash) prefix (\){{Octal|4632|\}}→ \11030
digit/no/none: Unformatted output{{Octal|4632|none}}→ 11030
TemplateData
[edit]TemplateData for Octal
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Decimal number | value1 | The number input to convert from decimal (base 10) to octal (base 8) | Number | required |
| Notation | affix2 | Select from a variety of common notations for octal values in lieu of the default subscripted 8
| Line | optional |