From: "Anthony W. Youngman" <thewolery@nospam.demon.co.uk>
Subject: Re: division by zero exceptions ?
Date: 1998/11/01 [thread overview]
Message-ID: <yFwYgQAgjJP2Ewvx@thewolery.demon.co.uk> (raw)
In-Reply-To: slrn73ofkl.hmt.billm@lorentz.melbpc.org.au
In article <slrn73ofkl.hmt.billm@lorentz.melbpc.org.au>, Bill Metzenthen
<billm@melbpc.org.au> writes
>On Sat, 31 Oct 1998 21:23:20 +0000, Anthony W. Youngman
> <thewolery@nospam.demon.co.uk> wrote:
>
>>See my other post - if I'm doing math, I WANT it to return the correct
>>value, ie if I say "x = y / tan( pi / 2)" then I WANT x to be set to
>>infinity. If I don't have to trap for divide by zero, then my thousand
>>lines becomes five hundred, and it's a damn sight easier to debug.
>>
>>Look at it as a mathematician, not an engineer. x divided by 0 IS
>>infinity, and I wish computers could cope with that fact, and not crash
>>my program.
>
>Hang on a moment, what do you mean by infinity? In the type of
>mathematics which most people would like to approximate with
>floating point mathematics, there is no such thing as infinity:
>x/0 is not a legal operation!
>
>I was interested to see your example where this fictitious object can
>be useful. Part of my background is in electrical engineering where
>having infinity can be useful e.g. when computing the impedance of
>parallel circuit branches when one of the branches is a short circuit.
>I thought that this was one of the few cases where the 1/0 = infinity
>behaviour was useful; your example adds one more to my list (1).
>
>For most computations 1/0 represents a severe error which should be
>dealt with as soon as it occurs.
I've actually remembered exactly what I was doing.
I wanted to plot wave height at a particular point in the ocean
(iteratively - I was building an extremes map) and I had a tape of
tropical storm data.
So for each storm in turn, I took the first segment (start-pos, end-pos)
and calculated the distance from my point to the storm track, then took
the next segment, calculated the distance and kept the shortest
distance, etc etc. I then had a list of "maximum wave height from each
storm".
As you can see, it's quite an interesting problem. I think all my
coordinates were integer minutes, but I had to calculate the formula of
the line of the storm track, then calculate the formula of a line
perpendicular to the track through my point. From that I could work out
if the perpendicular intercepted the track in which case that gave me my
distance, else work out which end of the track was closest to the
perpendicular and use that to give me my distance.
As you can see, if either d(lat)=0 or d(long)=0 my code would screw up.
You state that
>For most computations 1/0 represents a severe error
but I would beg to differ. For trig and algebra, 1/0 is a linear
infinity, and (like with eg superstrings) you don't give a damn about
infinity provided at the end they all cancel out and give you your
answer. Which for trig and algebra you know they will.
I agree that when you start dividing different degrees of infinity by
each other things start getting complicated ... It's just a case of
knowing your infinities (yes there are an INFINITE NUMBER of them, I
believe :-)
--
Anthony W. Youngman - wol at thewolery dot demon dot co dot uk
Trousers with a single hole in their waistband are topologically equivalent
to a doughnut. These sugarcoated trousers have yet to catch on at fast-food
outlets! (SuperStrings by F. David Peat)
If replying by e-mail please mail wol. Anything else may get missed amongst
the spam.
next prev parent reply other threads:[~1998-11-01 5:00 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-26 5:00 division by zero exceptions ? Conrad Sanderson
1998-10-26 5:00 ` Michal Jaegermann
1998-10-27 5:00 ` Remco Wouts
1998-10-28 5:00 ` Nils Faerber
1998-10-31 5:00 ` Shana Tackett
1998-10-30 5:00 ` James D. Freels
1998-10-31 5:00 ` Toon Moene
1998-10-31 5:00 ` Anthony W. Youngman
1998-11-01 5:00 ` Stefan Davids
1998-11-01 5:00 ` Bill Metzenthen
1998-11-01 5:00 ` Anthony W. Youngman [this message]
1998-11-02 5:00 ` Stefan Davids
1998-11-02 5:00 ` Bill Metzenthen
1998-11-02 5:00 ` Conrad Sanderson
1998-11-02 5:00 ` Michal Jaegermann
1998-10-31 5:00 ` Greg Lindahl
1998-11-03 5:00 ` rscanon
1998-10-31 5:00 ` Bill Metzenthen
1998-10-31 5:00 ` Anthony W. Youngman
1998-11-01 5:00 ` Greg Lindahl
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox