home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rxnum.zip
/
RXNUM.TXT
< prev
Wrap
Text File
|
1996-03-20
|
3KB
|
82 lines
RXNUM.DLL adds type conversion and math operations to REXX.
RXNUM handles positive integers in the range 0 ... 'FFFFFFFF'x
Copy RXNUM.DLL into a directory of your LIBPATH.
Functions:
NUMINIT Initialisation
Example: call RxFuncAdd 'numinit', 'RXNUM', 'numinit'
call numinit()
NUMDROP Drops the functions
Example: call numdrop
NUM2DEC Converts integer numbers to decimal form
NUM2HEX " " " " hexadec form
NUM2OCT " " " " octal form
NUM2BIN " " " " binary form
Syntax: RC = NUM2HEX('<d|h|o|b>||number')
d - from decimal to hexadec
h - from hexadec to hexadec
o - from octal to hexadec
b - from binary to hexadec
Returns: <result string> <operand error> <result error>
operand error: 0 - OK
14 - one of the operands is out of range.
result error: 0 - OK
2 - the result is out of range.
Example: SAY NUM2HEX('b11111111') -> FF 0 0
SAY NUM2DEC('hFFFFFFFFF') -> FFFFFFFF 14 0
NUMADD Adds two numbers
NUMSUB Substracts one number
NUMPROD Multiplies two numbers
NUMDIV Integer division
NUMMOD Modulo operation
NUMOR Bit OR of two numbers
NUMAND Bit AND of two numbers
NUMXOR Bit XOR of two numbers
NUMSHL 32 bit shift left
NUMSHR 32 bit shift right
Syntax: RC = NUMAND(num1,num2)
num1 and num2 must be in decimal notation!
The build in OR, AND and XOR function of REXX work on string
basis and do not give a correct result for numbers!
Returns: <result string> <operand error> <result error>
operand error: 0 - OK
14 - one of the operands is out of range.
result error: 0 - OK
2 - the result is out of range.
Example: SAY NUMADD(255,255) -> 510 0 0 : OK
SAY NUMPROD(4294967295,2) -> 4294967294 0 2 : invalid result!
SAY NUMDIV(9999999999,2) -> 2147483647 14 0 : operand too large!
SAY NUMSHL(2,4) -> 32 0 0 : 2 shifted left 4 times
SAY NUMDIV(100,0) -> 2 0 2 : invalid result!
You find more examples in NUM.CMD.
RXNUM.DLL is shareware without any restrictions. I do not like to test
any crippled shareware and I think you don't like it neither. Please
register online on CompuServe or send your money by mail when turning from
test phase to using phase.
Online Registration on CIS: GO SWREG 10523
Your comments are welcome also welcome.
My address:
Michael Mieves
Wessobrunner Weg 1
D-82407 Wielenbach
Germany
CIS: 100334,142
E-Mail: mieves@ibm.net