Àdàkọ:Calculate increment/doc
Èyí ni ìwé àlàyé ọjọ́ewésubpage fún Àdàkọ:Calculate increment. Ó ní àlàyé ìlò, àwọn ẹ̀ka àti àkóónú míràn tí wọn kò jẹ́ apá and other content that is not part of the original àdàkọ page. |
What it does
àtúnṣeCalculates suitable increments for {{scalemarkers}}. Increments are 1, 2 or 5 times an appropriate power of 10.
Variable 1 = from; Variable 2 = to.
Examples:
"{{calculate increment|10|30}}"
gives "2" [1]
Problems it has
àtúnṣeIt doesn't deal with small (<10) scales yet.
How it does it
àtúnṣeFirst we need to select the "base value" - i.e. what we're going to multiply by the power of 10. We use the following brackets:
- 14<35: 20
- 35-70 : 50
- 70->14: 10
To generate the first two digits is quite laborious. This code generates a suitably rounded number; we need to divide that by 10 n times.
1 round (2-1)}}
1
Then we need to select the power of 10.
0; 10