[Slightly OT]: More on ints and floats

Alex Martelli aleax at aleax.it
Sat Apr 12 22:08:53 CEST 2003

Cameron Laird wrote:
> 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.

I'm an engineer, and I fully concur with you (once you
generalize "different people" to include the SAME people
speaking ``with different hats on'', so to speak).  

When I speak about a given software program, and I assert 
that "1.0 is much better than 1.1, 'cause they added far 
more bugs than features in the upgrade", I expect it to be
quite clear that I'm using "release numbers" -- strange
beasts that can well have more than one decimal point
(e.g., the interlocutor might well object "That's unfair,
you're really compating 1.0.3 with 1.1.0!"...;-).  

In another context, though, I might well use "1.0" as being
distinct from "1.00" because the latter implies I've measured 
"it" (whatever "it" we're talking about) "to two decimal
places" (i.e., in such a context saying "the length is
1.00" DOES mean I claim it's between 0.995 and 1.005,
while if I said "the length is 1.0" I'd be making a far
less precise claim).  That's perhaps the sense in which
some people say that a floating-point number "stands
for an interval" (?).

In another context yet, I might well be using "1.0" as
quite equivalent to "float(1)" (after all, "1.0" IS the
form in which both str and repr render float(1)...:-).
I'd be likely to use that in just about any programming
language because I never remember what languages let me
skip the trailing zero AND "1." is less readable anyway;-).


More information about the Python-list mailing list