User:Kri/Backup of ConvertToBaseI
Converts an integer from decimal to another base.
Usage
{{ConvertToBaseI|number|base|...}} (see parameters)
Parameters
basename- The name of base, to be written in subscript after the number; to skip writing the base, set this parameter to 0. If this parameter is omitted, the base will be written in subscript after the number in its decimal number representation.
digitset- The name of the template containing the set of digits to use, for example {{HexadecimalDigit}}. If this parameter is omitted, each digit will be written in its decimal number representation.
separator- A separator to be written between the digits with an certain period. If this parameter is omitted, no separator will be written between the digits.
sepperiod- The period of the separator (if given). If this number non-positive, or the parameter is omitted, the period of the separator will be 1.
digitseparatorcount- Help variable for the template to keep track of how many digits it has written (from right to left) since the last separator. Omit this parameter for normal usage of the template.
Examples
{{ConvertToBaseI|100|2|basename=0}}gives 100
{{ConvertToBaseI|100|4}}gives 100
{{ConvertToBaseI|100|4|separator=,|sepperiod=3}}gives 100
{{ConvertToBaseI|100|16|digitset=Hexadecimal|basename=hex}}gives 100
Special cases
Negative numbers will be start with a minus sign to indicate their sign:
- −
{{ConvertToBaseI|100|4}}gives −100
Zero will always give the digit corresponding to the value 0:
{{ConvertToBaseI|0|16|digitset=Hexadecimal}}gives {{#if Hexadecimal |016|0}}
Numbers equal to or greater than 228 (268,435,456) are to big to be handled:
{{ConvertToBaseI|268435456|4}}gives N/A
See also
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.