home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases
- Path: sparky!uunet!pipex!warwick!mrccrc!ifenton
- From: ifenton@crc.ac.uk (I. Fenton)
- Subject: Re: HELP - HELP : CLIPPER BUG ???!!
- Message-ID: <1993Jan6.104331.27658@crc.ac.uk>
- Sender: news@crc.ac.uk
- Nntp-Posting-Host: tin
- Organization: MRC Human Genome Resource Centre
- References: <1993Jan5.160516.1@urc.tue.nl>
- Date: Wed, 6 Jan 1993 10:43:31 GMT
- Lines: 55
-
- In article <1993Jan5.160516.1@urc.tue.nl> rcrolf@urc.tue.nl writes:
- >Dear Clipper Freaks,
- >
- >I stumbled across a most horrible Clipper bug (at least I
- >think it's a bug .....).
- >
- >Look at the following source code :
- >
- >*================================================
- >var1 = 2382.80
- >var2 = 234.40
- >var3 = 2617.20
- >*-- THIS EQUATION EVALUATES TO FALSE !!!!!! (Totally wrong !)
- >?(var3 == (var1+var2))
- >*================================================
- >var1 = 2382.80
- >var2 = 234.20
- >var3 = 2617.00
- >*-- THIS EQUATION EVALUATES TO TRUE (Should be !)
- >?(var3 == (var1+var2))
- >*------------- End of code fragment ----------
- >
- >Does anyone out there has an explanation for this ???????
- >
- >Regard,
- >
- >Rolf.
-
- i am a clipper user, and sometimes a freak as well. to my naive mind it
- simply appears to be rounding error. remember that 0.1 (or multiples
- thereof) are recurring numbers in binary. hence doing == matching on
- multiples of 0.1 is dangerous. it could be as simple as that. try :-
-
- if (var1 + var2) - (var3) < 0.00001 then
- the number are as near as damn-it the same
- else
- they are different
- endif
-
- that is what i do....
-
- =============================================================================
- IAIN FENTON | All errors of spelling, grammar &
- Institute of Medical Genetics | fact are due to a missing <Del> key
- University of Wales College of Medicine |====================================
- Heath Park | "No man should marry until he has
- Cardiff CF4 4XN | studied anatomy and dissected at
- U.K. | least one woman" - de Balzac
- =============================================================================
- Voice = +44 - 222 - 744049 | In 1912, Jack Johnson, the first black world
- Fax = +44 - 222 - 747603 | heavyweight boxing champion, was refused
- Email = fenton@uk.ac.cardiff | permission to board the Titanic because of
- (or) ifenton@uk.ac.crc | his colour.
- =============================================================================
-
-