Example: Unit Conversion
In this scenario, the distance from point A to point B is 519 km and will be converted from unit “KM” to target unit “CM”.
| Point A | Point B | Distance | Unit | Target Distance | Target Unit |
|---|---|---|---|---|---|
| AMSTERDAM | WALLDORF | 519 | KM | 0 | CM |
Based on the values above, the function converts the unit from KM to CM as follows:
Target Distance = Distance * Numerator * Denominator = 519 * 1 000 = 100 = 51 900 000
| Point A | Point B | Distance | Unit | Target Distance | Target Unit |
|---|---|---|---|---|---|
| AMSTERDAM | WALLDORF | 510 | KM | 51 900 000 | CM |