home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:17842 comp.lang.c:18234 comp.programming:3311
- Path: sparky!uunet!cs.utexas.edu!sun-barr!decwrl!deccrl!news.crl.dec.com!dbased.nuo.dec.com!nntpd.lkg.dec.com!sousa.tay.dec.com!talent.ljo.dec.com!gibian
- From: gibian@talent.ljo.dec.com (Marc S. Gibian)
- Newsgroups: comp.lang.c++,comp.lang.c,comp.programming
- Subject: Re: How to make 3/0=INFINITY?
- Keywords: INFINITY, ADT
- Message-ID: <2314@sousa.tay.dec.com>
- Date: 11 Dec 92 22:41:44 GMT
- References: <ByC0Jx.1nF@math.uwaterloo.ca> <1992Nov27.072223.24022@donau.et.tudelft.nl> <1992Dec3.154907.25856@cis.ohio-state.edu>
- Sender: newsa@sousa.tay.dec.com
- Reply-To: gibian@ljohub.enet.dec.com
- Followup-To: comp.lang.c++
- Organization: Digital Equipment Corporation
- Lines: 29
-
-
- Many moons ago, when I was a math wiz, I did indeed spend a section of
- a mathematics class on theory of infinity. At the time it was fun, looking
- back it reminds me a lot of the current work in area of chaos theory.
-
- But, this is comp.programming, so why not answer the initial question:
-
- "How can I program so that 3 divided by 0 results in infinity?"
-
- The hardware types have pointed to the IEEE standard for floating point
- computations. Thats nice, but once again this is comp.programming, so
- here's a software solution:
-
- Use a language supporting operator overloading and data hidding, c++ and
- ADA come to mind first, and define your own data type ... how about
- infinite. The data structure would contain:
-
- real_value - a floating point number when values are not infinite
-
- infinite_value - an enumeration of values... based on my math
- experience, it would be:
- (negative-infinity, real, positive-infinity)
-
- The function definitions are left as an exercise (as I have to beat the
- blizzard home ;-)
- --
- Marc S. Gibian email: gibian@talent.ljo.dec.com
- Principal Software Engineer phone: (508) 486-6598
- Digital Equipment Corporation fax: (508) 486-6648 or (508) 486-6100
-