Module SIunits.Unit


module Unit: sig .. end
Definition of units.


Unit definitions



type u =
| Metre
| Second
| Minute
| Mole
| Gram
| Litre
| Amp
| Kelvin
| Candela
| Tera of u
| Giga of u
| Mega of u
| Kilo of u
| Deci of u
| Centi of u
| Milli of u
| Micro of u
| Nano of u
| Pico of u
| Femto of u
| Power of u * int
The type of a single unit of measure.

type d =
| Ratio of u list * u list (*The ratio of one set of units (the numerator) to another set of units (the denominator).*)
| Per of u list (*The reciprocal of a set of units.*)
| In of u list (*A set of units.*)
| NoUnits (*No units (i.e. dimensionless).*)
The units of a value are specified as some combination of individual units.
type t 
The abstract units type.

Unit creation


val create : ?scale:float -> d -> t
Define units by an optional multiplicative factor and some combination of SI units.
val scale : float -> t -> t
Define units as a multiple of some existing units.
val no_units : t
Units for dimensionless quantities.
val in_units : u list -> t
The given units.
val per : u list -> t
The reciprocal of the given units.
val ratio : u list -> u list -> t
The ratio of two sets of units.
val mult : t -> t -> t
Define units as the product of two existing units.
val ( %* ) : t -> t -> t
Define units as the product of two existing units.
val div : t -> t -> t
Define units as the ratio of two existing units.
val (%/) : t -> t -> t
Define units as the ratio of two existing units.

Unit properties


val dimensions_of : t -> d
Return the canonical dimensions for the given units.
val scale_of : t -> float
Return the multiplicative scaling factor for the given units.
val eq : t -> t -> bool
Compare two sets of units for equivalence, allowing for scalar differences.
val (%=) : t -> t -> bool
Compare two sets of units for equivalence, allowing for scalar differences.
val to_string : t -> string
Return the string representation of the value and units, where the numerical value includes the multiplicative scaling factor.