home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / ajcbcd.zip / AJCBCD.DOC next >
Text File  |  1994-06-18  |  23KB  |  613 lines

  1. AJCBCD - Binary Coded Decimal (BCD) Unit
  2.  
  3.  
  4. This unit was written using Borland International's Borland Pascal v7.0, and
  5. the Object Windows Library (OWL)/Turbo Vision (TV) library objects provided
  6. with that product.
  7.  
  8.  
  9.  
  10. I have not copyrighted this program, and donate it to the public domain.  All
  11. portions of this program may be used, modified, and/or distributed, in whole
  12. or in part.
  13.  
  14.  
  15. I wrote this unit to provide myself with some reusible functions that would
  16. provide support for BCD math similar to what I've grown accustomed to with
  17. the COBOL Packed Decimal (COMP-3) data type.  Note that in true "Packed
  18. Decimal", two decimal digits are "packed" into each data byte.  I chose not
  19. to implement my BCD support in that manner.  I may be less efficient in terms
  20. of space, but I simply placed a single decimal digit in each byte.
  21.  
  22. I am just a "hobby" programmer, having written nothing for anyone byt myself.
  23. Therefore, this unit may not be "elegant"; and, there are certainly better
  24. ways of implementing some of the routines that I coded (like perhaps coding
  25. some in assembler which I'm NOT very good at).  However, it has met my own
  26. needs, and I'm actually a little proud of what I accomplished here
  27. (especially in being able to figure out algorithms to multiply and divide!).
  28. By the way, let me admit one thing right up front...I have NOT tested ALL of
  29. the routines in this unit (in particular, the Divide routine).  I clearly
  30. marked all of the routines that have not been fully tested.  You can assume
  31. that all other routines HAVE been tested, because I used them in a real
  32. application.
  33.  
  34. This might not be the best BCD routines available, but they might actually be
  35. usefull to someone else--besides, it's free!  I am open to suggestions,
  36. comments, or enhancements (although, I can't promise quick turn around because
  37. I have a real job, plus I teach, plus I have a family--then I code for fun
  38. --in that order <grin>).  My CompuServe ID is 71331,501.
  39.  
  40. This unit exports some constants (described below).  But, the big deal in
  41. this unit is the Binary Coded Decimal object that this unit defines.  This
  42. object (TBCD) allows you to allocate a BCD data type of any number of digits.
  43. This object then provides methods for adding, subtracting, multiplying,
  44. and dividing to/from/by other numbers.  It also has methods for altering
  45. the number of digits stored as well as the precision (number of places after
  46. the decimal place).
  47.  
  48.  
  49. Constants
  50. ---------
  51. DigitSize - Stores the size, in bytes, of each individual digit (currently
  52.             one byte).
  53.  
  54. bpw_Fixed - Passed to the PicSTR and STRPic methods (see the description of
  55.             PicSTR for an explanation of how to use this constant).
  56.  
  57. bpw_Variable - See bpw_Fixed above.
  58.  
  59. bpz_Blank - See bpw_Fixed above.
  60.  
  61. bpz_NotBlank - See bpw_Fixed above.
  62.  
  63. MaxBCDSize - Limits the maximum number of BCD digits that can be allocated
  64.              for a BCD object.  Arbitrarily set to 100.
  65.  
  66. st_Blanks25 - A string constant containing 25 blanks.  Used just as a
  67.               convenience in building the st_Blanks constant (see below).
  68.  
  69. st_Blanks - A String constant containing 255 blanks.  Used simply as a
  70.             convenient reference/resource for lots of blanks (sort of like
  71.             the "SPACES" constant in COBOL).
  72.  
  73. RBCD - TStreamRec used for registering the TBCD object type for use with
  74.        streams.
  75.  
  76.  
  77. Var
  78. ---
  79. BCDZero - A PBCD object that is initialized to a value of zero in the unit's
  80.           initialization section.  Used as a convenience whenever you need
  81.           a BCD object with a value of zero.
  82.  
  83.  
  84. Type
  85. ----
  86. TBCDArray - An array of "MaxBCDSize" (100) bytes.  Allocated by the TBCD
  87.             object to store the BCD value.  Each byte stores an individual
  88.             digit of the value.
  89.  
  90. TBCDSign - An enumerated data type used by the TBCD object to represent the
  91.            sign of the BCD value.  Valid values are "BCDNegative" and
  92.            "BCDPositive".
  93.  
  94.  
  95.  
  96.  
  97. TBCD
  98. -----------------------------------------------------------------------------
  99.  TObject       TBCD
  100. ┌──────┐      ┌─────────────────────────────────┐
  101. │      │      │ BCDSize                         │
  102. ├──────┤      │ Sign                            │
  103. │ Init │      │ Value                           │
  104. │*Done │      │ Precision                       │
  105. │ Free │      ├─────────────────────────────────┤
  106. └──────┘      │ InitBCD         MultiplyByBCD   │
  107.               │ InitReal        MultiplyByReal  │
  108.               │ InitPChar       MultiplyByPChar │
  109.               │ Done            DivideByBCD     │
  110.               │ Load            DivideByReal    │
  111.               │ Store           DivideByPChar   │
  112.               │ GetValue        AbsoluteValue   │
  113.               │ GetSign         Increment       │
  114.               │ GetPrecision    Decrement       │
  115.               │ GetBCDSize      ShiftLeft       │
  116.               │ SetValueBCD     ShiftRight      │
  117.               │ SetValueReal    BCD2Int         │
  118.               │ SetValuePChar   BCD2Real        │
  119.               │ SetSign         PicStr          │
  120.               │ SetPrecision    StrPic          │
  121.               │ SetBCDSize      CompareBCD      │
  122.               │ AddBCD          CompareReal     │
  123.               │ AddReal         ComparePChar    │
  124.               │ AddPChar                        │
  125.               │ SubtractBCD                     │
  126.               │ SubtractReal                    │
  127.               │ SubtractPChar                   │
  128.               └─────────────────────────────────┘
  129.  
  130. Fields ---------------------------------------------------------------------
  131.  
  132. BCDSize:  Integer;                                                Read Only
  133.  
  134. The size, in number of digits, of the BCD number.  Count represents the
  135. available space for digits, and does NOT include the decimal point, or sign.
  136.  
  137.  
  138. Sign:  TBCDSign;                                                  Read Only
  139.  
  140. The mathmatical sign of the current value (i.e., indicates whether the
  141. current value is positive or negative).
  142.  
  143.  
  144. Value:  PBCDArray;                                                Read Only
  145.  
  146. A pointer to a TBCDArray (an array of bytes) used to store the value of the
  147. BCD number.  Even though TBCDArray is defined with "MaxBCDSize" entries, only
  148. BCDSize bytes are actually allocated from memory.  Therefore, you must be
  149. sure to be careful never to read or write to subscript values greater than
  150. BCDSize.  If you need to change the number of digits allocated you should use
  151. the SetBCDSize method.  The BCD value is stored in the array with the lowest
  152. order digit in the BCDSize position and the highest order digit in the 1st
  153. position.  For example, if BCDSize is 5, Precision is 2, and the value being
  154. stored is 2.35, then a 5-byte array would be allocated on the heap, and the
  155. array values would be (in order from position 1 to 5) (0, 0, 2, 3, 5).
  156.  
  157.  
  158. Precision:  Byte;                                                 Read Only
  159.  
  160. This value represents the number of digits after the decimal point.  Keep in
  161. mind that there is no actual decimal point stored.
  162.  
  163.  
  164. Methods ---------------------------------------------------------------------
  165.  
  166. InitBCD
  167.  
  168. constructor InitBCD(AVal: PBCD);
  169.  
  170. Sets BCDSize, Sign, and Precision to the same values as the BCD object
  171. referred to by AVal.  It then calls SetValueBCD passing AVal in order to
  172. allocate a TBCDArray for Value, and copies the AVal^.Value into this object's
  173. Value array.
  174.  
  175.  
  176. InitReal
  177.  
  178. constructor InitReal(AVal:  Real; APrec: byte; ASize: Integer);
  179.  
  180. Sets BCDSize to ASize, Precision to APrec, then calls SetValueReal(AVal) in
  181. order to allocate a Value array and initialize it with the value in AVal.
  182.  
  183.  
  184. InitPChar  ** Not yet tested **
  185.  
  186. constructor InitPChar(AVal:  PChar; APrec: byte; ASize: Integer);
  187.  
  188. Sets BCDSize to ASize, Precision to APrec, then calls SetValuePChar(AVal)
  189. in order to allocate a Value array and initialize it with the value in AVal.
  190.  
  191.  
  192. Done
  193.  
  194. destructor Done; virtual;
  195.  
  196. Frees the memory allocated for the Value array and calls "inherited Done".
  197.  
  198.  
  199. Load
  200.  
  201. constructor Load(var S: TStream);
  202.  
  203. constructs and loads a BCD object from the stream S by first loading BCDSize,
  204. Sign, the Value array, and last the Precision.
  205.  
  206.  
  207. Store
  208.  
  209. procedure Store(var S: TStream);
  210.  
  211. Stores the BCD object on the stream S by storing the BCDSize, Sign, Value
  212. array, and the Precision.
  213.  
  214.  
  215. GetValue
  216.  
  217. function GetValue: PBCDArray;
  218.  
  219. Allocates a new TBCDArray of size BCDSize and copies the value in Value into
  220. the new array, then returns a pointer to the new array.  Note that it will
  221. be the calling routine's responsibility for disposing the array pointed to by
  222. the returned pointer (use GetBCDSize to determine how much memory to free).
  223. FreeMem should be used for this disposal, not Dispose.
  224.  
  225.  
  226. GetSign
  227.  
  228. function GetSign: TBCDSign;
  229.  
  230. Returns the sign of the BCD value.  The sign is returned as a TBCDSign
  231. value; either "BCDNegative", or "BCDPositive".
  232.  
  233.  
  234. GetPrecision
  235.  
  236. function GetPrecision:  Byte;
  237.  
  238. Returns a byte value equal to the Precision (number of decimal places) of the
  239. BCD number.
  240.  
  241.  
  242. GetBCDSize
  243.  
  244. function GetBCDSize:  Inteteger;
  245.  
  246. Returns an integer value representing the number of BCD digits allocated in
  247. the Value array.
  248.  
  249.  
  250. SetValueBCD
  251.  
  252. procedure SetValueBCD(AVal: PBCD);
  253.  
  254. If Value is not nil, then the current Value array is freed.  Next, a new array
  255. of size BCDSize is allocated on the heap, by calling AVal^.GetValue.  Next,
  256. the copied value array is adjusted from the size and precision of AVal to
  257. the BCDSize and Precision of this BCD object (if different).  Lastly, the
  258. sign of the value is copied by calling AVal^.GetSign.
  259.  
  260.  
  261. SetValueReal
  262.  
  263. procedure SetValueReal(AVal:  Real);
  264.  
  265. The current value array is initialized to all zero digits.  AVal is converted
  266. to a string, and that string is copied digit by digit into the array.  If
  267. AVal is less than zero then Sign is set to BCDNegative, otherwise it is set
  268. to BCDPositive.
  269.  
  270.  
  271. SetValuePChar  ** Not Tested Yet **
  272.  
  273. procedcure SetValuePChar(AVal: PChar);
  274.  
  275. The current value array is initialized to all zero digits.  AVal is copied
  276. into the array digit by digit.  This routine validity checking to verify that
  277. the string actually represents a numeric value.  The only character values
  278. that are processed are:  1) numbers (0-9), 2) period (locates decimal point),
  279. and 3) minus sign or parentheses to determine that the sign is negative.
  280. Examples:  "(123.45)" would be interpreted as negative 123.45; "123.45" would
  281. be interpreted as positive 123.45; "-123.45" would be interpreted as negative
  282. 123.45.  Likewise, "555-55-5555" would be interpreted as a negative
  283. 555555555; and "I'll have 2" would be interpreted as a positive 2.  If there
  284. are no number characters in the string at all, then the resulting value is
  285. zero.
  286.  
  287.  
  288. SetSign
  289.  
  290. procedure SetSign(ASign: TBCDSign);
  291.  
  292. Sets Sign to ASign (either BCDNegative or BCDPositive).  Regardless of the
  293. value of ASign, if the Value of the BCD is zero, then SetSign forces Sign to
  294. be BCDPositive (in otherwords, BCD never stores a negative zero).
  295.  
  296.  
  297. SetPrecision
  298.  
  299. procedure SetPrecision(APrec: Byte);
  300.  
  301. Sets Precision to APrec.  It also shifts the value array left or right,
  302. depending on whether the precision is being increased or decreased.  If the
  303. decimals are shifted left, dropping high order digits (hopefully zeros), and
  304. padding zeros on the right.  If the precision is being decreased, the digits
  305. are shifted to the right, padding the high order digits with zeros, and
  306. dropping low order digits.  Note that the size of the value array is NOT
  307. changed by this method.
  308.  
  309.  
  310. SetBCDSize
  311.  
  312. procedure SetBCDSize(ASize: Integer);
  313.  
  314. Sets BCDSize to ASize.  It also allocates a new value array of the new size,
  315. and copies value from the original value array to the new one.  The value
  316. is copied right justified (in otherwords, high order digits are dropped
  317. or padded with zeros depending on whether the new size is larger or smaller
  318. than the old size).  The original value array is freed, and Value is set to
  319. point to the new value array.
  320.  
  321.  
  322. AddBCD
  323.  
  324. procedure AddBCD(AVal: PBCD);
  325.  
  326. Adds AVal^.Value to Self.Value.  This is a "signed add".  By that I mean that the
  327. signs of the two operands ARE taken into account when adding the two values
  328. together.  The result is stored in the Value array.  Mathmatically, it might
  329. be represented by the following formula:  "Self := Self + AVal;"
  330.  
  331.  
  332. AddReal
  333.  
  334. procedure AddReal(AVal: Real);
  335.  
  336. Converts AVal to a temporary PBCD object and calls AddBCD to add that
  337. temporary BCD number to Self.
  338.  
  339.  
  340. AddPChar  ** Not yet tested **
  341.  
  342. procedure AddPChar(AVal: PChar);
  343.  
  344. Converts AVal to a temporary PBCD object and calls AddBCD to add that
  345. temporary BCD number to Self.
  346.  
  347.  
  348. SubtractBCD
  349.  
  350. procedure SubtractBCD(AVal: PBCD);
  351.  
  352. Subtracts AVal^.Value from Self.Value.  This is a "signed subtract".  By that
  353. I mean that the signs of the two operands ARE taken into account when
  354. subtracting the two values.  The result is stored in the Value array.
  355. Mathmatically, it might be represented by the following formula:
  356. "Self := Self - AVal;"
  357.  
  358.  
  359. SubtractReal  ** Not yet tested **
  360.  
  361. procedure SubtractReal(AVal: Real);
  362.  
  363. Converts AVal to a temporary PBCD object and calls SubtractBCD to subtract
  364. that temporary BCD number from Self.
  365.  
  366.  
  367. SubtractPChar  ** Not yet tested **
  368.  
  369. procedure SubtractPChar(AVal: PChar);
  370.  
  371. Converts AVal to a temporary PBCD object and calls SubtractBCD to subtract
  372. that temporary BCD number from Self.
  373.  
  374.  
  375. MultiplyByBCD
  376.  
  377. procedure MultiplyByBCD(AVal: PBCD);
  378.  
  379. Multiplies Self.Value by AVal^.Value.  This is a "signed multiply".  By that
  380. I mean that the signs of the two operands ARE taken into account when
  381. multiplying the two values.  The result is stored in the Value array.
  382. Mathmatically, it might be represented by the following formula:
  383. "Self := Self * AVal;"
  384.  
  385.  
  386. MultiplyByReal  ** Not yet tested **
  387.  
  388. procedure MultiplyByReal(AVal: Real);
  389.  
  390. Converts AVal to a temporary PBCD object and calls MultiplyByBCD to
  391. multiply Self by that temporary BCD number.
  392.  
  393.  
  394. MultiplyByPChar  ** Not yet tested **
  395.  
  396. procedure MultiplyByPChar(AVal: PChar);
  397.  
  398. Converts AVal to a temporary PBCD object and calls MultiplyByBCD to
  399. mulitiply Self by that temporary BCD number.
  400.  
  401.  
  402. DivideByBCD  ** Not yet tested **
  403.  
  404. procedure DivideByBCD(AVal: PBCD);
  405.  
  406. Divides Self.Value by  AVal^.Value.  This is a "signed divide".  By that
  407. I mean that the signs of the two operands ARE taken into account when
  408. dividing the two values.  The result is stored in the Value array.
  409. Mathmatically, it might be represented by the following formula:
  410. "Self := Self/AVal;"
  411.  
  412.  
  413. DivideByReal  ** Not yet tested **
  414.  
  415. procedure DivideByReal(AVal:  Real);
  416.  
  417. Converts AVal to a temporary PBCD object and calls DivideByBCD to divide
  418. Self by that temporary BCD number.
  419.  
  420.  
  421. DivideByPChar  ** Not yet tested **
  422.  
  423. procedure DivideByPChar(AVal:  Real);
  424.  
  425. Converts AVal to a temporary PBCD object and calls DivideByBCD to divide
  426. Self by that temporary BCD number.
  427.  
  428.  
  429. AbsoluteValue
  430.  
  431. procedure AbsoluteValue;
  432.  
  433. Calls SetSign to set Sign to BCDPositive, regardless of its current value.
  434.  
  435.  
  436. Increment  ** Not yet tested **
  437.  
  438. procedure Increment;
  439.  
  440. Adds 1 Value.
  441.  
  442.  
  443. Decrement  ** Not yet tested **
  444.  
  445. procedure Decrement;
  446.  
  447. Subtracts 1 from Value.
  448.  
  449.  
  450. ShiftLeft
  451.  
  452. procedure ShiftLeft(ShiftAmount: Byte);
  453.  
  454. Shifts all of the digits left by ShiftAmount, dropping high order digits, and
  455. padding the low order digits with zeros.  The Precision of the number is NOT
  456. altered.  In effect, ShiftLeft multiplies Value by a power of 10.
  457.  
  458.  
  459. ShiftRight
  460.  
  461. procedure ShiftRight(ShiftAmount: Byte);
  462.  
  463. Shifts all of the digits right by ShiftAmount, dropping low order digits, and
  464. padding the high order digits with zeros.  The Precision of the number is NOT
  465. altered.  In effect, ShiftRight divides Value by a power of 10.
  466.  
  467.  
  468. BCD2Int  ** Not yet tested **
  469.  
  470. function BCD2Int: LongInt;
  471.  
  472. Converts the BCD value (and it's sign) to a LongInt data value.  Decimal
  473. positions are simply truncated, not rounded.  Range checking is not performed.
  474. If the number of significant digits of the BCD number (not counting decimal
  475. positions) is too large for a LongInt number, high order digits are lost,
  476. and the resulting LongInt value will probably be meaningless.
  477.  
  478.  
  479. BCD2Real  ** Not yet tested **
  480.  
  481. function BCD2Real:  Real;
  482.  
  483. Converts the BCD value (and it's sign) to a Real data value.  Range checking
  484. is not performed.  If the number of significant digits of the BCD number is
  485. too loarge for a Real number, the results are unpredictable, and will
  486. probably be meaningless.
  487.  
  488.  
  489. PicStr
  490.  
  491. function PicStr(picture: string;
  492.                 Width: Integer; BlankWhenZero: Boolean): string;
  493.  
  494. PicStr converts the BCD number into a formatted Pascal string.  If you are
  495. familiar with the used of Edit Numeric Formatting in Cobol, then you're a
  496. long ways toward understanding how to use this routine.
  497.  
  498. First, let's get the simple parameters out of the way...
  499.  
  500. Width indicates whether or not insignificant leading and trailing blanks
  501. should be removed from the resulting string.  If Width is equal to 0 then the
  502. length of the resulting string will always equal the length of Picture,
  503. regardless of any leading or trailing blanks in the result string.  If Width
  504. is equal to 1, then any leading and/or trailing blanks will be removed from
  505. the resulting string before returning.  For your convenience, two constants
  506. have been defined for use with this parameter:  bpw_Fixed = 0 and
  507. bpw_Variable = 1.
  508.  
  509. BlankWhenZero indicates whether the entire result string should be forced to
  510. completely blank, regardless of any formatting characters in Picture, if the
  511. formatted value is logically equal to zero.  The BCD value itself is NOT used
  512. to make this determination.  The determination is made by comparing the
  513. result string to the string from formatting BCDZero (zero value) with the
  514. same Picture string.  If the two strings are equal, then this result string
  515. is considered to be equal to zero.  If BlankWhenZero is true, then such zero
  516. valued results are forced to all blanks.  If BlankWhenZero is false, the
  517. the result string is left to whatever it becomes based on the Picture string.
  518. If BlankWhenZero is true, and Width = bpw_Fixed, then the result string is
  519. a string of blanks equal in length to the length of Picture.  If Width =
  520. bpw_Variable, the the result will be an empty strint ('').  For example, if
  521. the BCD number = 0.0023, and the formatted result is "0.00%", BlankWhenZero =
  522. false would result in "0.00%", while BlankWhenZero = true would result in a
  523. blank or empty string depending on Width.  For your convenience, two constants
  524. have been defined for use with this parameter:  bpz_Blank = true, and
  525. bpz_NotBlank = false.
  526.  
  527. Now, the more complicated part...picture...
  528.  
  529. The "picture" parameter is a string that provides a template for formatting
  530. the value of the BCDnumber.  The possible template characters are...
  531.   '9' - Fills with a digit from the value (or zero if no digit position
  532.         available in the BCD number)
  533.   'Z' - Just like '9', except that insignificant zeros (i.e., leading zeros)
  534.         are left blank.
  535.   'z' - Exactly the same as a capital "Z"
  536.   '$' - Just like 'Z', except that the right most unused (blank)
  537.         dollar-sign position is filled with a '$'.  COBOL afficianados will
  538.         recognize this as a "floating dollar sign".
  539.   '-' - Just like 'Z', except that if the BCD number value is negative, then
  540.         the right most unused (blank) dash position is filled with a '-'.
  541.         COBOL afficianoados will recognize this as a "floating negative sign".
  542.   '(' - If the template contains a parenthesis, and the BCD number value is
  543.         negative, then the result string is surrounded with parenthesis.
  544.   ')' - If the template contains a parenthesis, and the BCD number value is
  545.         negative, then the result string is surrounded with parenthesis.
  546.   '.' - Indicates the decimal point position, and is included in the result
  547.         string.  If the template does not contain a period, then the decimal
  548.         position is assumed to be at the right end of the template, no
  549.         decimal point is included in the result string, and no decimal place
  550.         values are included in the result string.
  551.   ',' - If any significant (non-zero) value positions precede the comma
  552.         position, then a comma is inserted at this position in the result
  553.         string.  This would normally be used to format commas to separate
  554.         thousands positions in large numbers.
  555.   ANY other characters are simply inserted into the result string in their
  556.   relative position.
  557.  
  558. Some examples might help...
  559.  
  560.     Value         Picture String         Fixed Result       Variable Result
  561.     123.45          '$$$$$9.99'           '  $123.45'        '$123.45'
  562.     123456.78       '$$$$$9.99'           '123456.78'        '123456.78'
  563.     123456.78       '$$$$$$9.99'          '$123456.78'       '$123456.78'
  564.     123456.78       '$,$$$,$$9.99'        '$123,456.78'      '$123,456.78'
  565.     123.45          '9999'                '0123'             '0123'
  566.     -1234.6         '---,--9.99'          ' -1,234.60'       '-1,234.60'
  567.     -10.15          '(99.99)'             '(10.15)'          '(10.15)'
  568.     10.15           '(99.99)'             ' 10.15 '          '10.15'
  569.     75              'z9.999%'             '75.000%'          '75.000%'
  570.  
  571. Got the idea?  I hope so.  I have developed a similar stand-alone routine
  572. for formatting inteter and real numbers, and find it to be a VERY handy way
  573. to nicely format my number values for presentation on the screen or on a
  574. paper report.
  575.  
  576.  
  577. StrPic  ** Not yet tested **
  578.  
  579. function StrPic(dest: PChar; picture: string;
  580.                 Width: Integer; BlankWhenZero: Boolean): PChar;
  581.  
  582. Calls PicStr(picture, Width, BlankWhenZero) to get a formatted Pascal string.
  583. This string is converted to an null terminated string.  StrLCopy is used to
  584. copy that null terminated string to Dest, limited by Size.  See PicStr for an
  585. explanation of the use of picture, Width, and BlankWhenZero.  StrPic returns
  586. a pointer to dest.
  587.  
  588.  
  589. CompareBCD
  590.  
  591. function CompareBCD(AVal: PBCD): Integer;
  592.  
  593. Compares the signed values of Self and AVal.  CompareBCD returns -1 if Self
  594. is less than AVal, returns +1 of Self is greater than AVal, and returns 0 if
  595. the two values are equal.
  596.  
  597.  
  598. CompareReal  ** Not yet tested **
  599.  
  600. function CompareReal(AVal: Real): Integer;
  601.  
  602. Converts AVal to a temporary PBCD object and calls CompareBCD to perform the
  603. actual comparison with that temporary BCD number.  CompareReal returns the
  604. value returned by CompareBCD.
  605.  
  606. ComparePChar  ** Not yet tested **
  607.  
  608.  
  609. function ComparePChar(AVal: PChar): Integer;
  610.  
  611. Converts AVal to a temporary PBCD object and calls CompareBCD to perform the
  612. actual comparison with that temporary BCD number.  ComparePChar returns the
  613. value returned by CompareBCD.