Re: Possreps and numeric types
Date: 26 Mar 2007 17:28:35 -0700
Message-ID: <1174955315.058977.104100_at_y80g2000hsf.googlegroups.com>
On Mar 26, 1:40 pm, Bob Badour <bbad..._at_pei.sympatico.ca> wrote:
>
> Try to keep in mind that computers are finite artifacts. As long as they
> remain so, we will have to contend with largest representable numbers
> and smallest representable differences.
Sure.
However it does not follow from that that it is impossible
to represent *any* number precisely.
We are perhaps speaking across each other with regards
to the issue of the set-of-all-rationals, and specific rationals.
Let R(x) mean "x is exactly representable in a computer under
a given model M."
Proposition A - there is some rational number that is not
representable:
Proposition B - there are no rational numbers that are representable:
not exists x in Q: R(x)
Clearly B does not follow directly from A. B may be
*true* but it is certainly not an implication of A.
I accept A. Proof:
{ x | R(x) } is a finite set, because a computer has a finite
number of states. Q is an infinite set. Therefore we can
conclude proposition A because of the pigeonhole principle.
I also claim proposition C - some rational numbers are representable:
exists x in Q: R(x)
Propositions A and C are consistent.
An alternative perspective:
Consider 32 bit numbers. Consider addition, subtraction,
and multiplication defined over these numbers such that
the result is the standard twos complement result, unless
there is an overflow or underflow, in which case the result
is a fault. (I believe that many CPUs support the necessary
instructions to do this fairly cheaply, although few compilers
take advantage of this fact.)
Any set of operations under the above system will do
one of two things:
Let Q be the set of rational numbers.
exists x in Q: not R(x)
Not every Integer is representable under the above system. But that's a necessary condition; there is *no* system possible which will represent all possible Integers.
Marshall