Nominal uses as names: student number, credit card number,
social security number, phone number; it makes no sense to try to find
the sum, difference, product, or quotient of such numbers.
Ordinal uses: scales on opinion questionnaires, other ratings such as
college football or basketball teams; again it makes no sense to find
the sum, difference, product, or quotient of such numbers. [Note that
even though it makes no sense to do this, it is often done in terms of
finding the average or even the standard deviation of such rankings,
as we do at WCC with the student opinion questionnaires. One of the
downsides of computers is that they have no scruples; tell them to add up
some numbers and find the average and a computer will do just that, even if it is
inappropriate to do so.]
Limits on the size of integers
In math we are happy to point out that there are an infinite number of integer values,
that there is no largest integer.
Within a computer system we generally have a limit to the size of integer values.
In fact, within certain computer languages there are various kinds of integer values
where each kind has its own limits on the allowed size of the integers that
can be represented within that kind of integer. Thus, in some languages we
can have an integer that must exist between `-128` and `127`. However,
a different kind of integer in such a system may be able to represent
values between `0` and `65535`. Or, there may be a kind of integer that holds values
from `-2,147,483,648` to `2,147,483,647`.
Ehen dealing with integers in a computer setting we do need to pay attention to
the limits on the size of the integers that are allowed. Although we could
find the sum `1427286105+486528172` we could not find `1427286105+986528172`
nor could we find `1427286105**486528172` since both of those problems would give a result
outside of the limits of integer representation.
Having noted the possible problems with using integers, we should also point out the the most common uses
of integers is to count things and we rarely count values beyond the limits of
integer representation.
Closed operations
Within the limits of the size of integers (just discussed) the operations of addition,
subtraction and multiplication are "closed". This is also true for exponentiation
where the exponent is a non-negative integer, but that is true because it is just a
shorthand for repeated multiplication.
In general, division of integers is not "closed". There are instances here a division of
integers yields another integer, as in 24/6,
but we usually have a fractional portion of the quotient.
Negative exponents of integers, with the exception of having
the base be 0 or 1, produce non-integer values. Therefore, exponentiation with negative
exponents is not closed.
The concept of a "closed" operation is important in computing because many languages
have "typed" variables. That is, they have variables that only store a specific type of value,
such as an integer. If an operation is "closed" then we can perform that operation on
values of a given type and have the result assigned to a variable of the same type. If an
operation is not closed, then we need to assign the result to some other type of variable.
Demonstrate the mathematical equivalence of fractions and decimals.
Terminating decimals
Repeating decimals
Point out that the distinction is related to our base ten system and that,
as we will see in Module 4, a fraction that is terminating in base ten
may be a repeating value in a different number base system, and a fraction that
is repeating in base ten may be terminating in another number base system.
Implications of repeating decimals with respect to limited representational size
We cannot directly represent a repeating decimal in a fixed number of digits (without the use of
some other symbols on paper)
Just like the size limits on integers, computers have a limited number of spaces
in which to represent "decimal" values. Therefore, most fractional values, what we
call rational numbers, can only be represented as really good approximations, ones that terminate
within the limits on the representational space, to the actual value.
For rational values, one way to get around this in computing is to keep values
as fractions of integers, maintaining both a numerator and a denominator.
In computing applications that are using rational numbers it is important, at the very start of the
programming process, to determine the accuracy that will be required, and then to
take the appropriate steps to be sure that the "approximations" being used will
not undermine that required accuracy.
Rounding
This will happen internally as repeating rational numbers are truncated to fit
in representational space.
This is also going to happen computationally when operations are performed on
rational values.
Computer output often employs rounding in the formatting of numeric output.
Irrational values are always non-repeating and as such have at best approximations within
computer systems.
Scientific notation as a way to express very large and very small values.