[Slightly OT]: More on ints and floats
Bengt Richter
bokr at oz.net
Wed Apr 9 03:26:51 CEST 2003
On Tue, 08 Apr 2003 17:14:31 -0000, claird at lairds.com (Cameron Laird) wrote:
>In article <kauu6b.f2d1.ln at boundary.tundraware.com>,
>Tim Daneliuk <tundra at tundraware.com> wrote:
> .
> .
> .
>>As a side note, this question was ultimately motivated by an entirely
>>different sort of "pure math" question: Does (integer) 1 = 1.0?
>>Engineers, physicists, and computer scientists all would
>>say "no" because of the precision problem with the latter number.
IMO there is no "precision problem" with the unique abstract number
normally associated with "1.0" or "1" or "ord('\x01')" or "I" or "one"
or "ein" or "uno" or "+1e0" or ... ;-)
>>I am unclear, though, on whether a mathematician understands
>>1.0 to mean 1.0000000... (a single number) or the _neighborhood_
>>around 1 with one digit precision.
> .
> .
> .
>I'm a (former) mathematician. I've always taken "1.0"
>to be a local, linguistic act, requiring me to infer
>the speaker's context. "1.0" means different things in
>the mouths of different people.
>
Well put. Of course, any sign whose inferred purpose was to
get your attention can be substituted for "1.0" in the above,
generalizing from speech to include other communicative acts ;-)
>The open interval (0.95, 1.05) is one of the plausible
>interpretations. It's not among the first half-dozen
>likely to come to my mind, though; maybe in the top
>ten ...
Half open [.095, 1.05) or [1.0, 2.0) seem more useful to me
if the intent is to imply intervals, but a single exact number
is the interpretation I prefer (and is in any case necessary
as a reference for the definition of the intervals).
Which brings me to my point: IMO the distinction between
abstract entities vs. their various concrete representations
is crucial to communicating clearly about ... well, just about
anything.
E.g., concretely, you can use your hands to represent floating
point .01 to 99. very simply: Use your fingers to represent
the digits in BCD, and expose one thumb to indicate the decimal
point position. Or if you like binary, you can take advantage
of your opposable thumb to put one between selected fingers
for .00000001 through 10000000. base 2. Or you can use various
squiggly marks made visible to the communicatee. Or you can tap
out a pattern on someone's knee, say in morse code, or do the same
with audible beeps, or hand someone a tray with several bowls
of pebbles, etc., etc. Not to mention intermediate hidden (to
human senses) physical representations that play a role in
storage and transmission of numeric information, such as in computers.
The point is, a single abstract entity can have any number of
representations. "Floating point number" can thus be interpreted
to indicate a selected state of one of the many possible concrete
floating point representation mechanisms, together with the
exact abstract numerical value represented.
If you want to refer to an exact interval related to the exact value,
that requires additional information, which you can supply implicitly
or explicitly by context (cf Cameron's comment above). IMO a single
exact abstract value typically retains it primacy as an interpretation
of the representation, whatever additional definitions extend relative
to that through some special convention of interpretation and implicit
information.
Another point that may become clearer if one thinks about abstractions
vs representations is that computers necessarily implement concrete
transformations of _representations_ -- i.e., they do not directly implement
abstract mathematical operations. Pouring the contents of two bowls of pebbles
into a single empty bowl can represent integer addition, but when a bowl
overflows, that is a special effect of the _implementation_ of addition, not of
addition as an abstract integer operation.
The special effects encountered in transforming floating point representations
to implement abstract mathematical operations are also mostly properties of
the representation mechanisms, not of the abstract math, but they happen at
many points _throughout_ the interval of real numbers that contains the domain
of operands and range of results with exact floating point representations. The
special effects don't just happen at the extremes, as with integers.
This makes it trickier to think about.
The special effects derive from the necessity of choosing a representation
of an exact number as a result where a representation of the exact mathematical
result may not be available. Often it _is_ available, and the result _is_ an exact
representation of the mathematically correct result, but often, too, that's not possible
for a particular representation mechanism.
I.e., the representations of two numbers in floating point can correspond exactly
to intended abstract operands, but it is possible that the implementation of addition
will transform the FPU state to yield a resulting FPU representation (which necessarily
has a specific exact abstract numerical interpretation), but whose abstract value is not
identical to the expected mathematically correct value in the abstract realm.
[OT] BTW, when thinking about such realities as wars and foreign populations, or immediate
surroundings, including one's body, etc., it is also interesting to note that there are
representation issues involved. I.e., (IMO) one's subjective experience of reality is an experience
of one's state of mind -- however that arose -- and thus is an experience of a _representation_
of reality, not of reality itself[1]. And perception of reality has a context, like perception of "1.0".
People are so full of context ;-) Otherwise how could they disagree so violently about reality?
(Of course the above reflects my internal representations of reality and results from mechanisms
for transforming those representations ;-)
[1] Except insofar as the state of mind itself is a part of reality, of course.
Regards,
Bengt Richter
More information about the Python-list
mailing list