A datatype consists of 3 constructs –
- The value space – the set of values the type describes
- Properties – the set of axioms the values follow
- Characterizing operations – the distinguishing operations (from other datatypes) that are allowed
The properties have the following features –
Equality
- Order
- Bound
- Cardinality
- Exact and Approximate
- Numeric
Every datatype has the equality property, as this is needed for data to be copied from disk to register and back, or copied from one paper to another.
Order has to do with whether the values are ordered and what type of order (total or partial) that might be.
Bound has to do with whether there are bounds on the set of values, such as the set of all non-negative integers is bounded below by zero.
Cardinality determines the number of values in the value space, and this could include countably or uncountably infinite. [[a set is countably infinite if its elements can be put into one to one correspondence with the natural numbers; e.g., natural numbers, integers, rational numbers!!, polynomials!!, but not the real numbers]].
Exact and approximate is used to declare whether the values represent their meaning exactly. E.g., floating point numbers are not always exact.
For the statistical datatypes, here are the properties that apply –
- Nominal: equality
- Ordinal: nominal plus ordered
- Interval: ordinal plus numeric, as numeric implies intervals are meaningful, i.e., for all x, y, z, then x-y=(x+z)-(y+z)
- Ratio: There aren’t additional properties we can supply to account for the need of a true zero
However, the characterizing operations add the appropriate additional conditions. The field operations for rationals and reals mean that zero is the additive identity, and this is sufficient.