Template:Calculate increment/doc

From blackwiki
< Template:Calculate increment
Revision as of 06:30, 13 September 2011 by imported>Jimp
Jump to navigation Jump to search

Usage

This template takes two numbers and calculates suitable increments for {{scalemarkers}} based on the difference between these numbers. Increments are 1, 2 or 5 times an appropriate power of 10.

Variable 1 = from; Variable 2 = to.

Examples:

Template:Xpd2

How it does it

First 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

This code generates a suitably rounded number; we need to divide that by 10 n times.