Wikipedia defines range of data type
:
the set of possible values that that variable can hold.
Suppose we have two data types A and B. Now, with attention to
the definition of widening in section 7.4
of Concepts of Programming Languages, we
can say:
range of B is larger than A when range of B includes at least approximations of all members of range of A.
But above definition is informal; because "accuracy" of approximation is not
determined. For example we can consider 0
as approximate for
0
of int
and 1
as approximate for
all other members of int
. So we give a strange statement:
range of
int
≤ range of {0,1}
Although we can add the |A| ≤ |B|
as a criteria to avoid
some strange statements like above one (|A|
means Cardinal number for set A
); but the problem of "accuracy" remains again.
Do you know a formal definition for "a data type with larger range"?