Design input for units library

Right, apologies, I left out a lot of information in the initial post. The fields in the unit class are meant to denote the powers of the seven basic dimensions.

For e.g., any quantity of type area would have the param length equal to 2 and the rest to zero. Similarly, velocity would have length equal to 1 and time equal to -1. (I hope that makes sense :stuck_out_tongue:)

The three fields in the length class come from:
value in SI unit = value * coefficient + constant
For example,
For 10 centimeters, it would be value in m = 10 * 0.01 + 0 or for 10 degrees centigrade, it would be value in K = 10 * 1 + 273.15.
I think this type of design would allow us to easily convert values between non-base SI units (like from centimeter to kilometer or nanometer.

The above was just a sort of proof of concept that we tried. What we are first aiming for would be:

var addition: length = new meter(10) + new centimeter(10); // value would return 10.1
var addition2: length = new centimeter(10) + new meter(10); // value would return 1010
var subtraction: length = new meter(10) - new centimeter(10); // value would return 9.9
var subtraction2: length = new centimeter(1000) - new meter(1); // value would return 900

// Something to achieve for later on
var area /* unclear about the type for this */ = new meter(10) * new centimeter(10);

In short, what we expect the library to handle initially:

  1. Addition
  2. Subtraction
  3. Conversion