home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases
- Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!dog.ee.lbl.gov!news!humu!pegasus!tleylan
- From: tleylan@pegasus.com (Tom Leylan)
- Subject: Re: HELP - HELP : CLIPPER BUG ???!!
- Message-ID: <1993Jan8.210306.8950@pegasus.com>
- Organization: Pegasus, Honolulu
- References: <1993Jan5.160516.1@urc.tue.nl>
- Date: Fri, 8 Jan 93 21:03:06 GMT
- Lines: 30
-
- In article <1993Jan5.160516.1@urc.tue.nl> rcrolf@urc.tue.nl writes:
-
- >I stumbled across a most horrible Clipper bug (at least I
- >think it's a bug .....).
-
- <floating point example deleted for space>
-
- Page 93 of The Elements of Programming Style by Kernighan and Plauger
-
- "Don't compare floating point numbers solely for equality"
-
- Clipper like BASIC, C and many other languages approximates floating
- point values. It can be easily seen in the following example:
-
- nVar := 1/3
- ? nVar + nVar + nVar
-
- One doesn't get 1.00 again.
-
- As K&P continue to write:
-
- "We do not have space to go more deeply into the mysteries of floating
- point computation; that is the province of numerical analysts. We
- intend only to emphasize that floating point computations should be used
- cautiously when controlling an algorithm. They should seldom be used
- for counting, nor should two computed floating point values be compared
- only for equality".
-
- tom
-
-