module Value:Creation and conversion of numerical quantities.sig
..end
type
t
exception Invalid_conversion of t * SIunits.Unit.d
SIunits.Value.scale_to
and SIunits.Value.convert
when a value
cannot be converted into the given units.exception Invalid_units of t * t * string
SIunits.Value.(+:)
, SIunits.Value.(-:)
and SIunits.Value.(<-:)
when two
values cannot be combined due to incompatible units. The string argument
identifies which function/operator raised the exception.val value : float -> SIunits.Unit.t -> t
val (%<) : float -> SIunits.Unit.t -> t
val units_of : t -> SIunits.Unit.t
val (=.) : float -> float -> bool
The algorithm is described in these articles by
Alberto Squassabia
and
Bruce Dawson
(older version
here).
val (=!.) : float -> float -> bool
SIunits.Value.(=.)
).val float_eq : ?rel:float -> ?abs:float -> unit -> float -> float -> bool
rel
: The relative error tolerance (default = 10-15).abs
: The absolute error tolerance (default = 10-200).val eq : t -> t -> bool
val (=:) : t -> t -> bool
val eq_units : t -> t -> bool
val (=?:) : t -> t -> bool
val assign : t Pervasives.ref -> t -> unit
Invalid_units
(v1, v2, "assign")
if the units of the two values
(v1
and v2
) are not compatible.val (<-:) : t Pervasives.ref -> t -> unit
Invalid_units
(v1, v2, "<-:")
if the units of the two values
(v1
and v2
) are not compatible.val get : t Pervasives.ref -> float
val (!:) : t Pervasives.ref -> float
val scale_to : t -> SIunits.Unit.t -> float
Invalid_conversion
(v, d)
if the value v
and units d
are not
compatible.val (%>) : t -> SIunits.Unit.t -> float
Invalid_conversion
(v, d)
if the value v
and units d
are not
compatible.val convert : value:float -> from:SIunits.Unit.t -> into:SIunits.Unit.t -> float
scale_to (create value from) into
or
value %< from %>into
.Invalid_conversion
(v, d)
if the numerical value and source units
v
are not compatible with the destination units d
.val (+:) : t -> t -> t
Invalid_units
(v1, v2, "+:")
if the units of the two values
(v1
and v2
) are not compatible.val (-:) : t -> t -> t
Invalid_units
(v1, v2, "-:")
if the units of the two values
(v1
and v2
) are not compatible.val ( *: ) : t -> t -> t
val (/:) : t -> t -> t
val ( *:. ) : t -> float -> t
val (/:.) : t -> float -> t
val (/.:) : float -> t -> t