home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / database / 8844 < prev    next >
Encoding:
Text File  |  1993-01-06  |  2.4 KB  |  68 lines

  1. Newsgroups: comp.databases
  2. Path: sparky!uunet!pipex!warwick!mrccrc!ifenton
  3. From: ifenton@crc.ac.uk (I. Fenton)
  4. Subject: Re: HELP - HELP : CLIPPER BUG ???!!
  5. Message-ID: <1993Jan6.104331.27658@crc.ac.uk>
  6. Sender: news@crc.ac.uk
  7. Nntp-Posting-Host: tin
  8. Organization: MRC Human Genome Resource Centre
  9. References: <1993Jan5.160516.1@urc.tue.nl>
  10. Date: Wed, 6 Jan 1993 10:43:31 GMT
  11. Lines: 55
  12.  
  13. In article <1993Jan5.160516.1@urc.tue.nl> rcrolf@urc.tue.nl writes:
  14. >Dear Clipper Freaks,
  15. >
  16. >I stumbled across a most horrible Clipper bug (at least I
  17. >think it's a bug .....).
  18. >
  19. >Look at the following source code :
  20. >
  21. >*================================================
  22. >var1 = 2382.80
  23. >var2 =  234.40
  24. >var3 = 2617.20
  25. >*-- THIS EQUATION EVALUATES TO FALSE !!!!!! (Totally wrong !)
  26. >?(var3 == (var1+var2))
  27. >*================================================
  28. >var1 = 2382.80
  29. >var2 =  234.20
  30. >var3 = 2617.00
  31. >*-- THIS EQUATION EVALUATES TO TRUE (Should be !)
  32. >?(var3 == (var1+var2))
  33. >*------------- End of code fragment ----------
  34. >
  35. >Does anyone out there has an explanation for this ???????
  36. >
  37. >Regard,
  38. >
  39. >Rolf.
  40.  
  41. i am a clipper user, and sometimes a freak as well.  to my naive mind it
  42. simply appears to be rounding error.  remember that 0.1 (or multiples
  43. thereof) are recurring numbers in binary.  hence doing == matching on
  44. multiples of 0.1 is dangerous.  it could be as simple as that.  try :-
  45.  
  46.    if (var1 + var2) - (var3) < 0.00001 then
  47.        the number are as near as damn-it the same
  48.    else
  49.        they are different
  50.    endif
  51.  
  52. that is what i do....
  53.  
  54. =============================================================================
  55. IAIN FENTON                             | All errors of spelling, grammar &
  56. Institute of Medical Genetics           | fact are due to a missing <Del> key
  57. University of Wales College of Medicine |====================================
  58. Heath Park                              | "No man should marry until he has
  59. Cardiff  CF4 4XN                        |  studied anatomy and dissected at
  60. U.K.                                    |  least one woman" - de Balzac
  61. =============================================================================
  62. Voice = +44 - 222 - 744049   | In 1912, Jack Johnson, the first black world
  63. Fax   = +44 - 222 - 747603   | heavyweight boxing champion, was refused
  64. Email = fenton@uk.ac.cardiff | permission to board the Titanic because of
  65.    (or) ifenton@uk.ac.crc    | his colour.
  66. =============================================================================
  67.  
  68.