home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxnum.zip / RXNUM.TXT < prev   
Text File  |  1996-03-20  |  3KB  |  82 lines

  1. RXNUM.DLL adds type conversion and math operations to REXX.
  2.  
  3. RXNUM handles positive integers in the range 0 ... 'FFFFFFFF'x
  4. Copy RXNUM.DLL into a directory of your LIBPATH.
  5.  
  6. Functions:
  7.  
  8. NUMINIT    Initialisation
  9. Example:   call RxFuncAdd 'numinit', 'RXNUM', 'numinit'
  10.            call numinit()
  11.  
  12. NUMDROP    Drops the functions
  13. Example:   call numdrop
  14.  
  15. NUM2DEC    Converts integer numbers to decimal form
  16. NUM2HEX        "        "      "     " hexadec form
  17. NUM2OCT        "        "      "     " octal   form
  18. NUM2BIN        "        "      "     " binary  form
  19. Syntax:    RC = NUM2HEX('<d|h|o|b>||number')
  20.                           d - from decimal to hexadec
  21.                           h - from hexadec to hexadec
  22.                           o - from octal to hexadec
  23.                           b - from binary to hexadec
  24. Returns:   <result string> <operand error> <result error>
  25.            operand error: 0  - OK
  26.                           14 - one of the operands is out of range.
  27.            result error:  0  - OK
  28.                           2  - the result is out of range.
  29. Example:   SAY NUM2HEX('b11111111')   ->  FF 0 0
  30.            SAY NUM2DEC('hFFFFFFFFF')  ->  FFFFFFFF 14 0
  31.  
  32. NUMADD     Adds two numbers
  33. NUMSUB     Substracts one number
  34. NUMPROD    Multiplies two numbers
  35. NUMDIV     Integer division
  36. NUMMOD     Modulo operation
  37. NUMOR      Bit OR of two numbers
  38. NUMAND     Bit AND of two numbers
  39. NUMXOR     Bit XOR of two numbers
  40. NUMSHL     32 bit shift left
  41. NUMSHR     32 bit shift right
  42.  
  43. Syntax:    RC = NUMAND(num1,num2)
  44.            num1 and num2 must be in decimal notation!
  45.            The build in OR, AND and XOR function of REXX work on string
  46.            basis and do not give a correct result for numbers!
  47.  
  48. Returns:    <result string> <operand error> <result error>
  49.            operand error: 0  - OK
  50.                           14 - one of the operands is out of range.
  51.            result error:  0  - OK
  52.                           2  - the result is out of range.
  53.  
  54. Example:   SAY NUMADD(255,255)       -> 510 0 0  : OK
  55.            SAY NUMPROD(4294967295,2) -> 4294967294 0 2 : invalid result!
  56.            SAY NUMDIV(9999999999,2)  -> 2147483647 14 0 : operand too large!
  57.            SAY NUMSHL(2,4)           -> 32 0 0 : 2 shifted left 4 times
  58.            SAY NUMDIV(100,0)         -> 2 0 2  : invalid result!
  59.  
  60. You find more examples in NUM.CMD.
  61.  
  62. RXNUM.DLL is shareware without any  restrictions. I do not like to test
  63. any crippled shareware and I think you don't like it neither. Please
  64. register online on CompuServe or send your money by mail when turning from
  65. test phase to using phase.
  66.  
  67. Online Registration on CIS: GO SWREG 10523
  68.  
  69. Your comments are welcome also welcome.
  70.  
  71. My address:
  72.  
  73. Michael Mieves
  74. Wessobrunner Weg 1
  75. D-82407 Wielenbach
  76. Germany
  77. CIS:    100334,142
  78. E-Mail: mieves@ibm.net
  79.  
  80.  
  81.  
  82.