[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
conversions, metric and variable
From: ho kooberpotikes <silent-tristero@q1ILIsI0vxlx5yzympmWRxFmzrocKV5M_JgGzuRCNzqQP6YWjME5ap2C6T_Nd1FmQjZM3FVyp8XaL6jV8n_koOBfZmdPvA.yahoo.invalid>
the pound exchange rate
from anton sherwood <antons@hHwG14mfEzlZIowwMpk7FvGFzn7cPxnOapv3uA8Avy-wN4An6xO7sZqqhZ1QQxdmKhR6G23Y.yahoo.invalid>
the mismeasure of space digest #1
from Eugene Leitl <eugene.leitl@77mEqfHJzLh9yfD1BHvj1TQCVp-CSaTsi9rCVUkpZDmLEqvdyDEQmkV8UEWi3iQTOkAfDAOs34WLqWB24dcJGwx4pZbPK3Dc.yahoo.invalid>
and Eric House <fixin@D29RbwbUBDC3jer6chMRjpZmlMJQQNPWz0iczB2yxPL6mSCvR89xPAioY15YOhV9wDsAX8s.yahoo.invalid>
and anton sherwood <antons@hHwG14mfEzlZIowwMpk7FvGFzn7cPxnOapv3uA8Avy-wN4An6xO7sZqqhZ1QQxdmKhR6G23Y.yahoo.invalid>
Re: Lost space probes and space urban legends
from Alan Winston - SSRL Central Computing <winston@eYDxN3eP6fj1cJ1SD2GeRG7SOLb8-OxVrE4AH-Wnocxzz-xae5K9-uFD1PEE-F9X0muHptM9zhzVga1_0qgjLw.yahoo.invalid>
and anton sherwood <antons@hHwG14mfEzlZIowwMpk7FvGFzn7cPxnOapv3uA8Avy-wN4An6xO7sZqqhZ1QQxdmKhR6G23Y.yahoo.invalid>
and Joel B Levin <levin@Ju4owTd1Aaz2Kxg7IpQIxbLENQ68dBta5lWhSo5NKwfun8eDPMI2BKcyNvsBE95RBmCB064.yahoo.invalid>
and Todd Larason <jtl@y0Sv77FpXsipQuAvqsIjE_iy0sXGrVsA-yO_KTTnz5t52X0NDJoK9yMoBYlZcVJPILwDsTtKMPg.yahoo.invalid>
and Chris Small <chris@GvirLhQf0WNsNLUeqogQA_u7uz_pTf_U4rANjQpr4TxV5QwAuX9YCCeDn9mhOITol-ewvtPGJPY3RtEtkHbx_OhMNYQTuw.yahoo.invalid>
and blob@sK5ZEGLlSBtCSP8oPdrHtscCPX6ywckZ9Kpzbn05YdDai44bbv-orw48exWR3PlfrklhAO6jpQsMuA.yahoo.invalid
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Date: Fri, 01 Oct 1999 23:54:12 -0700
From: anton sherwood <antons@hHwG14mfEzlZIowwMpk7FvGFzn7cPxnOapv3uA8Avy-wN4An6xO7sZqqhZ1QQxdmKhR6G23Y.yahoo.invalid>
Subject: the pound exchange rate
The moderator of RISKS writes, of the Martian oopsie:
[Thanks to all of you, too numerous to cite, for noting this item.
The measure in question was apparently kilograms per second vs. pounds
per second of force, off by a factor of 2.2, which would seem to
explain the too-close approach. The need for very strong typing
strikes again. PGN]
--
"How'd ya like to climb this high without no mountain?" --Porky Pine
Anton Sherwood *\\* +1 415 267 0685 *\\* http://www.jps.net/antons/
-----------------------------------------------------------
From: Eugene Leitl <eugene.leitl@77mEqfHJzLh9yfD1BHvj1TQCVp-CSaTsi9rCVUkpZDmLEqvdyDEQmkV8UEWi3iQTOkAfDAOs34WLqWB24dcJGwx4pZbPK3Dc.yahoo.invalid>
Date: Fri, 1 Oct 1999 10:29:09 -0700 (PDT)
Subject: the mismeasure of space digest #1
ho kooberpotikes writes:
> [In space navigation, what units you use aren't important.
In theory, there is no difference between which units you use. In
practice, there is.
> They're all just chunks of space, and the most meaningful
> measure is, perhaps, light-time (light-seconds, -minutes,
> -hours). And we don't measure time metrically.
Since you used "we" I assume you're an insider. Is there a reason you
don't use SI units other than tradition?
[I'm an insider in the sense that I wear a watch with sixty
marks around the edge of its dial.
Perhaps I should have said ``we don't measure time
decimally''. There are 60 seconds in a minute, not 100.
Therefore the calculation benefits of using multiples-of-ten
aren't an issue. A light-minute is not a convenient multiple
of a light-second, for example. --- dm]
> Metric really only has an advantage when one is converting
> from one size scale to another (from what fits in your hand,
> to what fits in your house to what fits in your state).
> There aren't that many places where one actually has to do
> that when calculating.
Whenever one is doing scientific calculations one better be sticking
to SI units, because they cancel out conveniently without requiring
fudge constants. Perhaps space navigation is not a scientific domain.
[That's a good point, I hadn't thought of that. And it would
certainly come into play in things like calculating thrust
and acceleration.
Though won't celestial navigation involve a fair number of
constants, anyway?
What units are used in commercial aviation? --- dm]
> In space navigation one doesn't talk about miles and feet,
> one talks about miles and fractions (tenths, hundredths) of a
> mile. One might, at some point, make a radical shift from
> one scale context to another: when landing a craft one might
> shift from outer-space's miles above a planet's surface to an
> atmosphere's feet above it.
Great, another islet of incompatibility. Why not furlongs per
fortnight?
[For the same reason we don't fret about kilometers per week.
--- dm]
> Why they're not metric in their machining is, perhaps, a
> bigger mystery. Or, it would be if converting to metric
> weren't a substantial capital cost with no significant gain
Interoperability demands will sooner or later force you to go
metric. The sooner, the better, imo. Only one measurement system will
survive on the long run.
[I'm not really surprised at the lack of a metric screw. I
*would* be surprised if a well-equipped machine shop couldn't
*fabricate* a metric screw, however. --- dm]
> (other than to the researcher who went looking for metric
> screws for his instrument imported from Britain). --- dm]
I guess loss of a space probe does not fall under substantial cost.
[The space probe was not lost because of the want of metric
tools in the workshops that built it. So no, it is not a
subtantial cost in the context of my paragraph. --- dm]
And of course that must be only the tip of the iceberg. Those
countless small "irritations" obviously don't translate into money
lost. Yeah, sure.
[Oh, sure, they do. But they're a dribble compared to a major
chunk of change like replacing all your cutting tools. The
fellow might have had equal difficulty in a British shop,
looking for a screw with the proper thread even after he
found one with the proper diameter and length. --- dm]
-----------------------------------------------------------
Date: Fri, 1 Oct 1999 12:43:47 -0700 (PDT)
From: Eric House <fixin@D29RbwbUBDC3jer6chMRjpZmlMJQQNPWz0iczB2yxPL6mSCvR89xPAioY15YOhV9wDsAX8s.yahoo.invalid>
Subject: Re: the mismeasure of space digest #1
> Why [NASA, etc. are] not metric in their machining is, perhaps, a
> bigger mystery. Or, it would be if converting to metric
> weren't a substantial capital cost with no significant gain
> (other than to the researcher who went looking for metric
> screws for his instrument imported from Britain). --- dm]
A machine-shop instructor once told us, his class, that
1) SAE threads are superior to metric in some way -- meaning stronger.
I believe it was related to the pitches either available or possible.
2) Because of this, the Canadian Navy uses custom fasterers having SAE
threads but taking metric tools.
Nonetheless, I've searched large industrial supply catalogs and
bothered Canadian machinist friends for these fasteners and have never
found even a confirmation. Perhaps the instructor had inhaled too
much aluminum dust.
--Eric House
******************************************************************************
* From the desktop of: Eric House, fixin@_Cxv9Qfd4cb2Y4q5W4rKR3MSXoFaaiE7vFd2o6n_e7kfTMTCeOmBuqATlcpGYy9Y31eSQMXYA2-P.yahoo.invalid *
* Check out Crosswords for PalmOS: <http://www.peak.org/~fixin/xwords> *
* "The instructions said 'Win98 or better' -- so I installed Linux" *
******************************************************************************
-----------------------------------------------------------
Date: Fri, 01 Oct 1999 23:23:47 -0700
From: anton sherwood <antons@hHwG14mfEzlZIowwMpk7FvGFzn7cPxnOapv3uA8Avy-wN4An6xO7sZqqhZ1QQxdmKhR6G23Y.yahoo.invalid>
Subject: Re: the mismeasure of space digest #1
> From: "Bryan O'Sullivan" <bos@UxgbOoFn8aN21xYbd2P9OrMoLjAZsvC6manZH3q-bHFLr29zltE899R1c1_K7PTS1xDICQzXfk0.yahoo.invalid>
>
> What chagrins me is that it had never occurred to me before that
> American engineers might use something other than metric units for
> "real work" (as opposed to building end tables and the like).
> So much for being familiar with one's adopted country.
It never occurred to me either (in respect to space navigation),
and I've not only lived here since very early childhood --
I've *done* real engineering work in inches!
--
"How'd ya like to climb this high without no mountain?" --Porky Pine
Anton Sherwood *\\* +1 415 267 0685 *\\* http://www.jps.net/antons/
-----------------------------------------------------------
Date: Sat, 02 Oct 1999 01:45:25 -0700 (PDT)
From: Alan Winston - SSRL Central Computing <winston@eYDxN3eP6fj1cJ1SD2GeRG7SOLb8-OxVrE4AH-Wnocxzz-xae5K9-uFD1PEE-F9X0muHptM9zhzVga1_0qgjLw.yahoo.invalid>
Subject: Re: Lost space probes and space urban legends
Sean Colbath writes:
The subject of lost space probes has reminded me of something. I've
repeatedly heard a story about a lost space probe from the 60s (mariner?)
that was lost due to a FORTRAN programming bug. The bug went something like
this: because spaces don't matter in FORTRAN, and because variables can be
implictly defined, a programmer was allowed to write:
DO 10 I=1.10
...
...
10 CONTINUE
instead of
DO 10 I=1,10
...
...
10 CONTINUE
so instead of 10 trips through the loop, he got one, with I set to 1.10.
Misinterpreted. See below.
What I want to know is: is this story true, or is it space urban legend?
I've never really seen anything that refutes this story conclusively.
Snopes is silent on this subject.
I can't give a cite, although I think I saw it referred to, uncontradicted,
in ACM Risks SIG hardcopy in the early 1980s, and found it completely
plausible.
[the reason I've suspected this to be apocryphal is that most versions of
FORTRAN implictly define all variables starting with I thru N to be integer
(INteger, get it), so you couldn't assign a decimal value to I. But this
was a long time ago, and the rules were probably different]
Nope. Sure, variables starting with I-N are variables, but remember that
FORTRAN generally doesn't have reserved words. (FORTRAN parsers are harder
to write than are those for languages designed by people who know why
FORTRAN parsers are hard to write.)
DO 10 I=1.10 compresses not to a do loop but to a single variable declaration
and initialization: DO10I = 1.10 Since the variable begins with D, it's
implicitly a real, and this is a legitimate assignment.
You fall through and get one trip through the loop, during which I is set to
an implementation-specific undefined value. Some FORTRANs preinitialize
undefined integers to 0. Referring to it should have produced an error
message, but it may have been used as the loop variable of a previous
DO loop, in which case most FORTRANs I've encountered leave it at the
incremented value; eg, do 10 I = 1,10 would actually leave I at 11.
But this is also undefined behavior.
This all fails silently because "CONTINUE" is a no-op placeholder instruction,
not a loop termination instruction, and the compiler doesn't think anything is
wrong if it encounters a CONTINUE that isn't in a loop, the way it would if
it hit an END DO in F77. It's actually the statement label that terminates
the loop, but unreferenced statement labels are legal (although they produce
warnings on some compilers), and there might well be an early exit from the
loop body that does a GOTO 10, so the label gets referenced.
The lesson I learned from this story was to, in FORTRANs that allow it, do
IMPLICIT NONE
and declare all my variables, even the annoying temporary ones. As soon as
I got onto F77, I used the block-structured loop forms, and let the compiler
work for me instead of against me.
I _think_ the story is true. Even if it isn't true, I know it's valuable.
-- Alan
===============================================================================
Alan Winston --- WINSTON@Gd5nKDXLVM_lw9rDn74EenkHAHr3iYSFjvEUCbK8GmukpZ9zqcEPFALUFUlR0U43dJ6YWPZOzWbAV7MR57IDQdSEKdVwYtQ.yahoo.invalid
Disclaimer: I speak only for myself, not SLAC or SSRL Phone: 650/926-3056
Physical mail to: SSRL -- SLAC BIN 69, PO BOX 4349, STANFORD, CA 94309-0210
===============================================================================
-----------------------------------------------------------
Date: Sat, 02 Oct 1999 14:43:34 -0700
From: anton sherwood <antons@hHwG14mfEzlZIowwMpk7FvGFzn7cPxnOapv3uA8Avy-wN4An6xO7sZqqhZ1QQxdmKhR6G23Y.yahoo.invalid>
Subject: Re: Lost space probes and space urban legends
Sean Colbath wrote:
[...]
>
> DO 10 I=1.10
> instead of
> DO 10 I=1,10
>
[...]
>
> [the reason I've suspected this to be apocryphal is that most versions
> of FORTRAN implictly define all variables starting with I thru N to be
> integer (INteger, get it), so you couldn't assign a decimal value to I.
> But this was a long time ago, and the rules were probably different]
An integer variable cannot *hold* a fractional value, but you can assign
floating values to it all day; they're truncated.
But that's not what happened here. I don't think DO allows nonintegers
(variable or constant) anywhere in the control, so the offending line was
analyzed as DO10I = 1.10, i.e. the auto-declared real variable DO10I was
assigned the perfectly valid real value 1.10, "I" was left unchanged, and
succeeding lines were executed once.
--
"How'd ya like to climb this high without no mountain?" --Porky Pine
Anton Sherwood *\\* +1 415 267 0685 *\\* http://www.jps.net/antons/
-----------------------------------------------------------
Subject: Re: Lost space probes and space urban legends
Date: Fri, 01 Oct 1999 13:39:10 -0400
From: Joel B Levin <levin@Ju4owTd1Aaz2Kxg7IpQIxbLENQ68dBta5lWhSo5NKwfun8eDPMI2BKcyNvsBE95RBmCB064.yahoo.invalid>
From "Sean Colbath" <scolbath@jQCJFdDy55q5dMqQ49oi-oduRjNGgrvUlMWYAKNP_xPIaUbpofD97seLHdpiK8SQAbWOtMgBy42Gbg.yahoo.invalid>:
}[the reason I've suspected this to be apocryphal is that most versions of
}FORTRAN implictly define all variables starting with I thru N to be integer
}(INteger, get it), so you couldn't assign a decimal value to I. But this
}was a long time ago, and the rules were probably different]
Conversion from floating to integer was also implicit across the
assignment ( = ) operator.
/JBL
-----------------------------------------------------------
Date: Fri, 1 Oct 1999 10:50:20 -0700
From: Todd Larason <jtl@y0Sv77FpXsipQuAvqsIjE_iy0sXGrVsA-yO_KTTnz5t52X0NDJoK9yMoBYlZcVJPILwDsTtKMPg.yahoo.invalid>
Subject: Re: Lost space probes and space urban legends
On 01 October 99, Sean Colbath wrote:
> What I want to know is: is this story true, or is it space urban legend?
It ought to be true, but apparently it isn't.
Peter van der Linden (another alt.folklore.urban old hat, nearly as voracious
as snopes himself) weighs in with
http://www.urbanlegends.com/science/mariner_i.html
which in turn points to his book _Deep C Secrets_.
Said book gives a fuller picture, though; evidentally the DO I=1.10 bug *was*
a real bug, but was in the Mercury program rather than Mariner, and was
discovered before serious harm was done. PvdL cites the RISKS digest V9 #54
for his version of this. This is available at
ftp://ftp.sri.com/risks/9/risks-9.54
The Mariner failure was due to software error, but of a more mundane sort: the
software met its specifications, which were wrong. The urbanlegends archive
article gives some references for this, but none with URLs or which happen to
be on my bookshelf, so they don't really count.
-----------------------------------------------------------
Date: Fri, 01 Oct 1999 14:58:45 -0400
From: Chris Small <chris@GvirLhQf0WNsNLUeqogQA_u7uz_pTf_U4rANjQpr4TxV5QwAuX9YCCeDn9mhOITol-ewvtPGJPY3RtEtkHbx_OhMNYQTuw.yahoo.invalid>
Subject: Re: Lost space probes and space urban legends
> The subject of lost space probes has reminded me of something.
> [...]
> DO 10 I=1.10
> [...]
> [the reason I've suspected this to be apocryphal is that most versions of
> FORTRAN implictly define all variables starting with I thru N to be integer
This is the way I heard the story. (There are no lost space probes in my
story, just lost time.)
[Putting on my language lawyer hat...]
In Old Fortran, spaces were not lexically significant; some Fortran compilers
would ignore all whitespace when parsing. So
DO 10 I=1,10
DO 10 I = 1 , 10
DO10I=1,10
would all be the same to the compiler.
Now let's suppose you wrote out your programs long-hand on coding paper (like
graph paper) [*][**] and wrote
DO 10 I=1,10
but were not careful with your commas, and the keypunch operator read the ","
as a ".", you'd get
DO 10 I=1.10
which would parse the same as
DO10I = 1.10
Since "do10i" starts with 'd', it's implicitly a real, so it can be assigned
1.10 w/o error.
This is why grammar (language) design should not be left to amateurs, because
what seem like simple design decisions can make it REALLY easy to write bad
code. (For reference: C, C++, Perl, Snobol, Tcl, APL, ...)
[Taking off language lawyer hat...]
- Chris
[*] To the young'uns in the audience: no, I am not making this up.
[**] In 1992 I worked with someone who wrote his programs out longhand, on
notebook paper, and gave them to his secretary to key in. He felt that this
was the best way to write code. The project we were working on? A software
development and configuration management system...
-----------------------------------------------------------
From: blob@sK5ZEGLlSBtCSP8oPdrHtscCPX6ywckZ9Kpzbn05YdDai44bbv-orw48exWR3PlfrklhAO6jpQsMuA.yahoo.invalid
Date: Fri, 1 Oct 1999 15:45:00 -0700
Subject: Re: Lost space probes and space urban legends
At 10:54 AM -0400 10/1/99, Sean Colbath wrote:
>The subject of lost space probes has reminded me of something. I've
>repeatedly heard a story about a lost space probe from the 60s (mariner?)
>that was lost due to a FORTRAN programming bug. The bug went something like
>this: because spaces don't matter in FORTRAN, and because variables can be
>implictly defined, a programmer was allowed to write:
>
> DO 10 I=1.10
> ...
> ...
>10 CONTINUE
>
>instead of
>
> DO 10 I=1,10
> ...
> ...
>10 CONTINUE
>
>so instead of 10 trips through the loop, he got one, with I set to 1.10.
>
>What I want to know is: is this story true, or is it space urban legend?
>I've never really seen anything that refutes this story conclusively.
>Snopes is silent on this subject.
It's true. There are many descriptions of this. One reference is
"Beyond the Limits -- Flight Enters the Computer Age" by Paul
Ceruzzi. The space probe was Mariner I, but the destruction wasn't
due to Fortran. There was a separate Fortran problem. See
<http://www.rchrd.com/Misc-Texts/Famous_Fortran_Errors> for one
description of the bug.
--Brian Bechtel, blob@sK5ZEGLlSBtCSP8oPdrHtscCPX6ywckZ9Kpzbn05YdDai44bbv-orw48exWR3PlfrklhAO6jpQsMuA.yahoo.invalid
-----------------------------------------------------------