home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / nan_news / vol3 / no5 / equal.prg < prev    next >
Text File  |  1989-03-01  |  915b  |  35 lines

  1. * Function: Equal()
  2. * Author:   Tim Wong
  3. * Version:  Clipper Summer '87
  4. * Note(s):  The function does an absolute comparison of
  5. *           two numbers.
  6. *
  7. * Copyright (c) 1989 Nantucket Corporation.
  8.  
  9. FUNCTION Equal
  10. PRIVATE RetVal        && The return value.
  11.  
  12. IF PCOUNT() = 4
  13.    * When numbers 1 and 2, length of the number
  14.    * and number of decimal places are passed.
  15.  
  16.    PARAMETERS Num1, Num2, NumLen, DecSpc
  17.  
  18.    IF NumLen > 32     && Forces the 16 significant digits
  19.       NumLen = 32     && limit on the conversion.
  20.    ENDIF
  21.    IF DecSpc > 16
  22.       DecSpc = 16
  23.    ENDIF
  24.  
  25.    RetVal = IIF(STR(Num1,NumLen,DecSpc) == STR(Num2,NumLen,;
  26.       DecSpc),.T.,.F.)
  27. ELSE
  28.    PARAMETERS Num1, Num2
  29.  
  30.    * When only numbers 1 and 2 are passed.
  31.    RetVal = IIF(STR(Num1,32,16) == STR(Num2,32,16),.T.,.F.)
  32.    * Note the truncation of the numbers to 16 significant digits.
  33. ENDIF
  34. RETURN(RetVal)
  35.