Representing scientific units in code.
I have been working on implementing a stream reader for IEEE 1451.4 TEDS and came across this interesting paper regarding representation of scientific units in code. It provides solutions to determining unit equivalency (eg. V/(m•kg/s²) = m/(s•A)). Also discovered some indivisible base units that can represent any unit (amp, candela, kelvin, gram, meter, mole, radian, second). With a bit to represent the placement (high for numerator, low for denominator) and a bit for presence, a unit storage type can be derived that only occupies 2 bytes.
Leave a comment