Skip to main content

Module unit_conversion

Module unit_conversion 

Source
Expand description

Conversion between common units of measure.

Units are looked up by symbol or name, ignoring spaces. An exact, case-sensitive match is tried first (mW is a milliwatt and MW a megawatt, MB a megabyte and Mb a megabit); otherwise case is ignored if that leaves only one unit (hz, pa and kwh work), and a spelling that fits several units, such as mw, is an error rather than a guess. Conversion is allowed only within one physical dimension; temperatures use affine conversions.

See the book entry Shared types, constants and utilities.

Enums§

Dimension
Physical dimension of a unit.

Functions§

db_to_linear_amplitude
Converts decibels to an amplitude ratio.
db_to_linear_power
Converts decibels to a power ratio.
dbm_to_watts
dBm to power in watts.
linear_amplitude_to_db
Converts an amplitude (voltage) ratio to decibels, 20 log10(ratio).
linear_power_to_db
Converts a power ratio to decibels, 10 log10(ratio).
unit_conversion
Converts value from unit from to unit to, e.g. unit_conversion(100.0, "km/h", "mph").
unit_dimension
The dimension of a named unit.
watts_to_dbm
Power in watts to dBm.