Quantities

A quantity in the general sense is a property ascribed to phenomena, bodies, or substances that can be quantified for, or assigned to, a particular phenomenon, body, or substance. The library defines seven basic quantities (length, mass, time, electric current, thermodynamic temperature, amount of a substance, and luminous intensity) and additional quantities can be derived as products of powers of the seven basic quantities (e.g., “volume” and “acceleration”). All quantities are unitless – they describe what can be measured but not how to measure it.

Unlike many other quantity implementations, this one is able to distinguish between dimensionless things like mass fractions (mass/mass) and length fractions (length/length). It does so by canceling numerators with denominators except when the numerator and denominator are equal. That is, mass/mass is considered a different quantity than length/length.

The library defines the seven basic quantities whose names follow the format “SAF__QX” where “X” is replaced by one of the words LENGTH, MASS, TIME, CURRENT, TEMP, AMOUNT, or LIGHT. Additional quantities can be derived from these by first creating an empty quantity and then multiplying powers of other quantities. For instance, volume per unit time would be defined as

1
2
3
 SAF_Quantity *q_vpt = saf_declare_quantity(SAF_ALL, db, "volume per time", "vol/time", NULL);
 saf_multiply_quantity(SAF_ALL, q_vpt, SAF_QLENGTH, 3);
 saf_multiply_quantity(SAF_ALL, q_vpt, SAF_QTIME, -1);

The reader is encouraged to visit physics.nist.gov/cuu/Units/units.html to get more information about quantities and units.