Skip to main content

Module conversion

Module conversion 

Source
Expand description

Units and conversion. A Unit maps its own scale to coherent SI by an affine transform si = value·factor + offset (the offset is only non-zero for the temperature scales — Celsius, Fahrenheit). Conversion between two units requires matching dimensions and fails closed otherwise.

Structs§

Unit
A named unit of a given dimension, defined by its affine map to coherent SI base units: si_value = value * to_si_factor + to_si_offset.

Functions§

convert
Convert value from one unit to another. Fails closed if the units have different dimensions (e.g. metres → seconds).