`(require 'metric-units)`

http://people.csail.mit.edu/jaffer/MIXF

Metric Interchange Format is a character string encoding for numerical values and units which:

- is unambiguous in all locales;
- uses only [TOG] "Portable Character Set" characters matching "Basic Latin" characters in Plane 0 of the Universal Character Set [UCS];
- is transparent to [UTF-7] and [UTF-8] UCS transformation formats;
- is human readable and writable;
- is machine readable and writable;
- incorporates SI prefixes and units;
- incorporates [ISO 6093] numbers; and
- incorporates [IEC 60027-2] binary prefixes.

In the expression for the value of a quantity, the unit symbol is placed
after the numerical value. A dot (PERIOD, ‘`.`’) is placed between
the numerical value and the unit symbol.

Within a compound unit, each of the base and derived symbols can optionally have an attached SI prefix.

Unit symbols formed from other unit symbols by multiplication are
indicated by means of a dot (PERIOD, ‘`.`’) placed between them.

Unit symbols formed from other unit symbols by division are indicated by
means of a SOLIDUS (‘`/`’) or negative exponents. The SOLIDUS must
not be repeated in the same compound unit unless contained within a
parenthesized subexpression.

The grouping formed by a prefix symbol attached to a unit symbol constitutes a new inseparable symbol (forming a multiple or submultiple of the unit concerned) which can be raised to a positive or negative power and which can be combined with other unit symbols to form compound unit symbols.

The grouping formed by surrounding compound unit symbols with
parentheses (‘`(`’ and ‘`)`’) constitutes a new inseparable symbol
which can be raised to a positive or negative power and which can be
combined with other unit symbols to form compound unit symbols.

Compound prefix symbols, that is, prefix symbols formed by the juxtaposition of two or more prefix symbols, are not permitted.

Prefix symbols are not used with the time-related unit symbols min (minute), h (hour), d (day). No prefix symbol may be used with dB (decibel). Only submultiple prefix symbols may be used with the unit symbols L (liter), Np (neper), o (degree), oC (degree Celsius), rad (radian), and sr (steradian). Submultiple prefix symbols may not be used with the unit symbols t (metric ton), r (revolution), or Bd (baud).

A unit exponent follows the unit, separated by a CIRCUMFLEX (‘`^`’).
Exponents may be positive or negative. Fractional exponents must be
parenthesized.

Factor Name Symbol | Factor Name Symbol ====== ==== ====== | ====== ==== ====== 1e24 yotta Y | 1e-1 deci d 1e21 zetta Z | 1e-2 centi c 1e18 exa E | 1e-3 milli m 1e15 peta P | 1e-6 micro u 1e12 tera T | 1e-9 nano n 1e9 giga G | 1e-12 pico p 1e6 mega M | 1e-15 femto f 1e3 kilo k | 1e-18 atto a 1e2 hecto h | 1e-21 zepto z 1e1 deka da | 1e-24 yocto y

These binary prefixes are valid only with the units B (byte) and bit. However, decimal prefixes can also be used with bit; and decimal multiple (not submultiple) prefixes can also be used with B (byte).

Factor (power-of-2) Name Symbol ====== ============ ==== ====== 1.152921504606846976e18 (2^60) exbi Ei 1.125899906842624e15 (2^50) pebi Pi 1.099511627776e12 (2^40) tebi Ti 1.073741824e9 (2^30) gibi Gi 1.048576e6 (2^20) mebi Mi 1.024e3 (2^10) kibi Ki

Type of Quantity Name Symbol Equivalent ================ ==== ====== ========== time second s time minute min = 60.s time hour h = 60.min time day d = 24.h frequency hertz Hz s^-1 signaling rate baud Bd s^-1 length meter m volume liter L dm^3 plane angle radian rad solid angle steradian sr rad^2 plane angle revolution * r = 6.283185307179586.rad plane angle degree * o = 2.777777777777778e-3.r information capacity bit bit information capacity byte, octet B = 8.bit mass gram g mass ton t Mg mass unified atomic mass unit u = 1.66053873e-27.kg amount of substance mole mol catalytic activity katal kat mol/s thermodynamic temperature kelvin K centigrade temperature degree Celsius oC luminous intensity candela cd luminous flux lumen lm cd.sr illuminance lux lx lm/m^2 force newton N m.kg.s^-2 pressure, stress pascal Pa N/m^2 energy, work, heat joule J N.m energy electronvolt eV = 1.602176462e-19.J power, radiant flux watt W J/s logarithm of power ratio neper Np logarithm of power ratio decibel * dB = 0.1151293.Np electric current ampere A electric charge coulomb C s.A electric potential, EMF volt V W/A capacitance farad F C/V electric resistance ohm Ohm V/A electric conductance siemens S A/V magnetic flux weber Wb V.s magnetic flux density tesla T Wb/m^2 inductance henry H Wb/A radionuclide activity becquerel Bq s^-1 absorbed dose energy gray Gy m^2.s^-2 dose equivalent sievert Sv m^2.s^-2

* The formulas are:

- r/rad = 8 * atan(1)
- o/r = 1 / 360
- db/Np = ln(10) / 20

— Function: **si:conversion-factor**` to-unit from-unit`

If the strings

from-unitandto-unitexpress valid unit expressions for quantities of the same unit-dimensions, then the value returned by`si:conversion-factor`

will be such that multiplying a numerical value expressed infrom-units by the returned conversion factor yields the numerical value expressed into-units.Otherwise,

`si:conversion-factor`

returns:

- -3
- if neither
from-unitnorto-unitis a syntactically valid unit.- -2
- if
from-unitis not a syntactically valid unit.- -1
- if
to-unitis not a syntactically valid unit.- 0
- if linear conversion (by a factor) is not possible.

(si:conversion-factor "km/s" "m/s" ) ⇒ 0.001 (si:conversion-factor "N" "m/s" ) ⇒ 0 (si:conversion-factor "moC" "oC" ) ⇒ 1000 (si:conversion-factor "mK" "oC" ) ⇒ 0 (si:conversion-factor "rad" "o" ) ⇒ 0.0174533 (si:conversion-factor "K" "o" ) ⇒ 0 (si:conversion-factor "K" "K" ) ⇒ 1 (si:conversion-factor "oK" "oK" ) ⇒ -3 (si:conversion-factor "" "s/s" ) ⇒ 1 (si:conversion-factor "km/h" "mph" ) ⇒ -2