From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10c696,c887bec98cd793ef X-Google-Attributes: gid10c696,public X-Google-Thread: 111c93,c887bec98cd793ef X-Google-Attributes: gid111c93,public From: billm@melbpc.org.au (Bill Metzenthen) Subject: Re: division by zero exceptions ? Date: 1998/11/01 Message-ID: #1/1 X-Deja-AN: 407224217 References: <01be0482$6ebd1e60$45934b0c@default> <71f8bc$clh$3@newnews.nl.uu.net> Organization: Melbourne PC User Group Inc, Australia Reply-To: billm@melbpc.org.au Newsgroups: comp.os.linux.alpha,comp.os.linux.development.apps On Sat, 31 Oct 1998 21:23:20 +0000, Anthony W. Youngman 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. (1) Note that in both cases, I would argue that it is really a projective infinity which is being used. Really old Intel FPU's used to support these but now they only support affine infinities. -- ----------------------------------------------------------------------------- Bill Metzenthen | See http://www.suburbia.net/~billm/ for information billm@melbpc.org.au | on an 80x87 FPU emulator, using floating point billm@suburbia.net | (particularly on Linux), and code for manipulating Melbourne, Australia | the floating point environment on 80x86 Linux. -----------------------------------------------------------------------------