home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / b / baswiz19.zip / BW$BAS.ZIP / BCDFRAC.BAS < prev    next >
BASIC Source File  |  1993-01-29  |  1KB  |  26 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |        BASWIZ  Copyright (c) 1990-1993  Thomas G. Hanlin III         |
  4. '   |                                                                      |
  5. '   |                      The BASIC Wizard's Library                      |
  6. '   |                                                                      |
  7. '   +----------------------------------------------------------------------+
  8.  
  9.    DECLARE FUNCTION BCDFormat$ (Nr AS STRING, HowToFormat%, RightDigits%)
  10.    DECLARE FUNCTION BCDSet$ (NumSt$)
  11.    DECLARE SUB BCDGetSize (LeftDigits AS INTEGER, RightDigits AS INTEGER)
  12.  
  13.    DEFINT A-Z
  14.  
  15. FUNCTION BCDFrac$ (Nr AS STRING)
  16.    BCDGetSize LDigits, RDigits
  17.    St$ = BCDFormat$(Nr, 0, RDigits)
  18.    tmp = INSTR(St$, ".")
  19.    IF tmp THEN
  20.       St$ = "0" + MID$(St$, tmp)
  21.    ELSE
  22.       St$ = "0"
  23.    END IF
  24.    BCDFrac$ = BCDSet$(St$)
  25. END FUNCTION
  26.