[Slightly OT]: More on ints and floats

Michael Hudson mwh at python.net
Wed Apr 9 06:13:41 EDT 2003


Lulu of the Lotus-Eaters <mertz at gnosis.cx> writes:

> |Floats are perfectly normal rational numbers; it's the *operations*
> |which are weird.
> 
> Aren't you being slightly disingenuous here?

Maybe.  But you've chopped the bit of my post where I was making my
real point: floating point numbers (in the compter sense) are not best
thought of as intervals of real numbers.

> Any numbers are more-or-less only meaningful in terms of the operations
> they enter into.  The Peano integers, or the Cauchy or Dedekind Reals,
> are not really interesting because of the beauty of their construction,

Well, in the case of the reals, the construction is of no interest
because there is only one model up to unique isomorphism...

And you're talking to the wrong mathematician: I do not relish in the
Bourbaki-style games of building all of mathematics up from axiomatic
set theory.  I'll grudgingly grant that it may be important that it
can be done, but all attempts to show me the constructions will be
studiously ignored.

> but rather because it is relatively easy to define operations on them
> that match our intuitions about how arithmetic is -supposed- to behave.
> The operations are the whole point of the entities.

Well, yeah, but there's a perfectly well defined, injective map from 

    {CS-floats} -> Q

but it doesn't commute with the arithmetic operations.  That's all I
meant.

> Likewise, a float isn't *really* a number at all.  It's really just a
> pattern of bits, such as '01000001010000010100000101000001'.  Maybe
> those bits are a way of representing the string "AAAA", or maybe they
> are a way of representing a -thing- that enters into operations that act
> (a little bit) like addition, multiplication, etc.  Just being a bit
> pattern doesn't make it a *number* at all.

Well, be like that then :-) It depends what you mean by "float".  I
always try very hard to know which category I'm working in.  Is {-1,
1} just a random subset of the set of integers?  No, it's the group of
units of the initial object of the category of commutative rings!

This is one thing Grothendieck got absolutely right: one should
always, always, always consider the relative situation (i.e. think
about morphisms rather than maps).  So a float is a bit pattern such
as '01000001010000010100000101000001', but to be a float it has to
come with an arrow that explains it's interpretation.

Cheers,
M.

-- 
  ZAPHOD:  Listen three eyes, don't try to outwierd me, I get stranger
           things than you free with my breakfast cereal.
                    -- The Hitch-Hikers Guide to the Galaxy, Episode 7




More information about the Python-list mailing list