Différences entre les pages « Modèle:Param » et « Modèle:Precision1 »
De Les Mots de l'agronomie
(Différence entre les pages)
imported>Jacques Ducloy m (1 révision importée) |
imported>Jacques Ducloy m (1 révision importée) |
||
Ligne 1 : | Ligne 1 : | ||
− | <includeonly> | + | <includeonly>{{ |
− | {{ | + | #expr:{{ |
− | + | #ifeq:{{{1}}} | |
− | = | + | | 0 |
− | + | | 0 | |
− | + | | {{ | |
− | = | + | #ifexpr:{{{1}}} round 0={{{1}}} |
− | + | | 0 | |
− | + | | {{ | |
− | + | #ifexpr:{{{1}}} round 1={{{1}}} | |
− | + | | 1 | |
− | + | | {{ | |
− | + | #ifexpr:{{{1}}} round 2={{{1}}} | |
− | : | + | | 2 |
− | + | | {{ | |
− | + | #ifexpr:{{{1}}} round 3={{{1}}} | |
− | : | + | | 3 |
− | + | | {{ | |
− | }} | + | #ifexpr:{{{1}}} round 4={{{1}}} |
− | + | | 4 | |
− | + | | {{ | |
− | + | #ifexpr:{{{1}}} round 5={{{1}}} | |
− | + | | 5 | |
− | + | | 6 | |
− | </noinclude> | + | }} |
+ | }} | ||
+ | }} | ||
+ | }} | ||
+ | }} | ||
+ | }} | ||
+ | }} | ||
+ | + | ||
+ | {{#switch:x{{{1}}} | ||
+ | | x0{{#expr:{{{1}}}+0}}0 | ||
+ | | x0{{#expr:{{{1}}}+0}}.0 | ||
+ | | x{{#expr:{{{1}}}+0}}0 | ||
+ | | x{{#expr:{{{1}}}+0}}.0=1 | ||
+ | | x0{{#expr:{{{1}}}+0}}00 | ||
+ | | x0{{#expr:{{{1}}}+0}}.00 | ||
+ | | x{{#expr:{{{1}}}+0}}00 | ||
+ | | x{{#expr:{{{1}}}+0}}.00=2 | ||
+ | | x0{{#expr:{{{1}}}+0}}000 | ||
+ | | x0{{#expr:{{{1}}}+0}}.000 | ||
+ | | x{{#expr:{{{1}}}+0}}000 | ||
+ | | x{{#expr:{{{1}}}+0}}.000=3 | ||
+ | | x0{{#expr:{{{1}}}+0}}0000 | ||
+ | | x0{{#expr:{{{1}}}+0}}.0000 | ||
+ | | x{{#expr:{{{1}}}+0}}0000 | ||
+ | | x{{#expr:{{{1}}}+0}}.0000=4 | ||
+ | | x0{{#expr:{{{1}}}+0}}00000 | ||
+ | | x0{{#expr:{{{1}}}+0}}.00000 | ||
+ | | x{{#expr:{{{1}}}+0}}00000 | ||
+ | | x{{#expr:{{{1}}}+0}}.00000=5 | ||
+ | | x0{{#expr:{{{1}}}+0}}.000000 | ||
+ | | x{{#expr:{{{1}}}+0}}.000000=6 | ||
+ | | 0 | ||
+ | }} | ||
+ | }}</includeonly><noinclude>{{Precision1/Documentation}}</noinclude> |
Version actuelle datée du 28 décembre 2020 à 11:45
- Utilité
Modèle adapté de en:Template:Precision1, donnant la précision d'un nombre (le nombre de chiffres après la virgule) jusqu'à 6.
- Exemples
Entrée | Sortie |
---|---|
{{Precision1|111.12345678}} | 6 |
{{Precision1|111.1234567}} | 6 |
{{Precision1|111.123456}} | 6 |
{{Precision1|111.12345}} | 5 |
{{Precision1|111.1234}} | 4 |
{{Precision1|111.123}} | 3 |
{{Precision1|111.12}} | 2 |
{{Precision1|111.1}} | 1 |
{{Precision1|111}} | 0 |
{{Precision1|110}} | 0 |
{{Precision1|100}} | 0 |
{{Precision1|111.10}} | 2 |
{{Precision1|111.100}} | 3 |
{{Precision1|111.1000}} | 4 |
Entrée | Sortie |
---|---|
{{Precision1|1.000}} | 3 |
{{Precision1|1.0000}} | 4 |
{{Precision1|1.00000}} | 5 |
{{Precision1|1.000000}} | 6 |
{{Precision1|01.000}} | 3 |
{{Precision1|01.0000}} | 4 |
{{Precision1|01.00000}} | 5 |
{{Precision1|01.000000}} | 6 |