module Decimal:sig..end
A decimal number is represented internally in base 10 and
characterized by its precision (i.e., its total number of digits)
and its scale. For example, 103.12 has precision 5 (or more) and
scale 2. In this implementation, the precision is taken as
+infinity and the scale adapts dynamically.
type t
val to_string : t -> stringto_string n returns a string representation of the decimal
number n.val to_float : t -> floatto_float n returns the closer float to n.val of_string : ?scale:int -> string -> tof_string ?scale s returns the decimal number represented by
the string s. If the option scale is not set, the scale
will be the one of the string representation. If scale is
given, it will be enforced, possibly truncating the number.Invalid_argument if scale < 0.val of_int : ?scale:int -> int -> tof_int ?scale i returns the decimal number i * 10**(-scale).Invalid_argument if scale < 0.scale : Scaling of i (default: 0).val add : t -> t -> tadd n m returns the sum of n and m.val sub : t -> t -> tsub n m returns the difference of n by m.val mul : t -> t -> tmul n m returns the product of n and m.val div : t -> t -> tdiv n m returns the division of n by m.val compare : t -> t -> intcompare n m returns 0 if x=y, a negative integer if
x<y, and a positive integer if x>y.