Modèle:Dec-hex : Différence entre versions
(Page créée avec « <includeonly><!-- if one -->{{#ifeq:<!-- if -->{{#expr:255<{{{1|256}}}}}|0|<!-- then 2 digit code -->{{Decimal to hexadecimal converter/Switch|<!-- ---->{{#expr:<!-- -... ») |
(Obsolète, {{/doc}} --> {{Documentation}}) |
||
(9 révisions intermédiaires par 3 utilisateurs non affichées) | |||
Ligne 1 : | Ligne 1 : | ||
+ | <includeonly>{{#invoke: Convert base | fromDec | {{{1}}} | 16 }}</includeonly><noinclude> |
||
− | <includeonly><!-- |
||
+ | {{Documentation}} |
||
− | if one |
||
− | -->{{#ifeq:<!-- |
||
⚫ | |||
− | if |
||
⚫ | |||
− | -->{{#expr:255<{{{1|256}}}}}|0|<!-- |
||
⚫ | |||
− | |||
− | then |
||
− | 2 digit code |
||
− | |||
− | |||
⚫ | |||
− | ---->{{#expr:<!-- |
||
− | ------>{{#expr:<!-- |
||
− | -------->floor({{{1|16777215}}}/16)<!-- |
||
− | ------>}}<!-- |
||
− | ------> mod 16<!-- |
||
− | ---->}}<!-- |
||
− | -->}}<!-- |
||
− | -->{{Decimal to hexadecimal converter/Switch|<!-- |
||
− | ---->{{#expr:<!-- |
||
− | ------>{{{1|16777215}}} mod 16<!-- |
||
− | ---->}}<!-- |
||
− | -->}}<!-- |
||
− | |||
− | else --->|{{#ifeq:<!-- |
||
− | if |
||
− | |||
− | |||
− | -->{{#expr:4095<{{{1|4096}}}}}|0|<!-- |
||
− | |||
− | |||
− | then |
||
− | 3 digit code |
||
− | |||
− | |||
− | |||
− | -->{{Decimal to hexadecimal converter/Switch|<!-- |
||
− | ---->{{#expr:<!-- |
||
− | ------>{{#expr:<!-- |
||
− | -------->floor(floor({{{1|16777215}}}/16)/16)<!-- |
||
− | ------>}}<!-- |
||
− | ------> mod 16<!-- |
||
− | ---->}}<!-- |
||
− | -->}}<!-- |
||
− | -->{{Decimal to hexadecimal converter/Switch|<!-- |
||
− | ---->{{#expr:<!-- |
||
− | ------>{{#expr:<!-- |
||
− | -------->floor({{{1|16777215}}}/16)<!-- |
||
− | ------>}}<!-- |
||
− | ------> mod 16<!-- |
||
− | ---->}}<!-- |
||
− | -->}}<!-- |
||
− | -->{{Decimal to hexadecimal converter/Switch|<!-- |
||
− | ---->{{#expr:<!-- |
||
− | ------>{{{1|16777215}}} mod 16<!-- |
||
− | ---->}}<!-- |
||
− | -->}}<!-- |
||
− | |||
− | |||
− | else --->|<!-- |
||
− | 6 digit code |
||
− | |||
− | |||
− | -->{{Decimal to hexadecimal converter/Switch|<!-- |
||
− | ---->{{#expr:<!-- |
||
− | ------>{{#expr:<!-- |
||
− | -------->floor(floor(floor(floor(floor({{{1|16777215}}}/16)/16)/16)/16)/16)<!-- |
||
− | ------>}}<!-- |
||
− | ------> mod 16<!-- |
||
− | ---->}}<!-- |
||
− | -->}}<!-- |
||
− | -->{{Decimal to hexadecimal converter/Switch|<!-- |
||
− | ---->{{#expr:<!-- |
||
− | ------>{{#expr:<!-- |
||
− | -------->floor(floor(floor(floor({{{1|16777215}}}/16)/16)/16)/16)<!-- |
||
− | ------>}}<!-- |
||
− | ------> mod 16<!-- |
||
− | ---->}}<!-- |
||
− | -->}}<!-- |
||
− | -->{{Decimal to hexadecimal converter/Switch|<!-- |
||
− | ---->{{#expr:<!-- |
||
− | ------>{{#expr:<!-- |
||
− | -------->floor(floor(floor({{{1|16777215}}}/16)/16)/16)<!-- |
||
− | ------>}}<!-- |
||
− | ------> mod 16<!-- |
||
− | ---->}}<!-- |
||
− | -->}}<!-- |
||
− | -->{{Decimal to hexadecimal converter/Switch|<!-- |
||
− | ---->{{#expr:<!-- |
||
− | ------>{{#expr:<!-- |
||
− | -------->floor(floor({{{1|16777215}}}/16)/16)<!-- |
||
− | ------>}}<!-- |
||
− | ------> mod 16<!-- |
||
− | ---->}}<!-- |
||
− | -->}}<!-- |
||
− | -->{{Decimal to hexadecimal converter/Switch|<!-- |
||
− | ---->{{#expr:<!-- |
||
− | ------>{{#expr:<!-- |
||
− | -------->floor({{{1|16777215}}}/16)<!-- |
||
− | ------>}}<!-- |
||
− | ------> mod 16<!-- |
||
− | ---->}}<!-- |
||
− | -->}}<!-- |
||
− | -->{{Decimal to hexadecimal converter/Switch|<!-- |
||
− | ---->{{#expr:<!-- |
||
− | ------>{{{1|16777215}}} mod 16<!-- |
||
− | ---->}}<!-- |
||
− | -->}}<!-- |
||
− | |||
− | end ifs |
||
− | -->}} }}<!-- |
||
− | |||
⚫ | |||
− | {{/doc}} |
||
− | |||
⚫ |
Version actuelle datée du 18 mars 2021 à 11:55
[voir | modifier | historique | purger]Documentation
Ce modèle permet de convertir une valeur décimale en une valeur hexadécimale. La valeur hexadécimale est longue au maximum de 6 caractères, ce qui correspond à une valeur décimale maximale de 16 777 215.
Utilisation
{{Dec-hex|1234}}
affichera : 4D2
[voir | modifier | historique | purger]La documentation ci-dessus est insérée depuis Modèle:Dec-hex/doc.