Function Descriptions [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation
HP FORTRAN 77/iX Reference
Function Descriptions
The FORTRAN 77 generic functions follow, in alphabetical order. The
functions that do not have a generic name are listed alphabetically by
specific name.
ABS Function
ABS(arg) is a generic function that returns the absolute value of an
INTEGER*4, REAL*4, REAL*8, REAL*16, or COMPLEX*8 argument. A complex
value is expressed as an ordered pair of REAL*4 or REAL*8 numbers in the
form (ar,ai) where ar is the REAL*4 part and ai is the imaginary part.
If arg is COMPLEX*8, ABS(arg) is equal to the square root of (ar**2 +
ai**2). For INTEGER*4, REAL*4, REAL*8, and REAL*16 arguments, the result
is the same data type as the argument. For COMPLEX*8 arguments, the
result is REAL*4.
Examples
------------------------------------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
------------------------------------------------------------------------------------
| | |
| a = ABS(100) | 100 |
| | |
| a = ABS(-100.0) | 100.0 |
| | |
| a = ABS(vector) | 28.32716, where vector = (12.84,25.25) |
| | |
| a = ABS(-1.23451234512345D2) | 123.451234512345 |
| | |
------------------------------------------------------------------------------------
The specific function names are ABS for REAL*4 arguments, CABS for
COMPLEX*8 arguments, DABS for REAL*8 arguments,
QABS for REAL*16 arguments,
IABS and JIABS for INTEGER*4 arguments, HABS and IIABS for INTEGER*2
arguments, and ZABS and CDABS for COMPLEX*16 arguments. IABS can also be
used as a generic name for HABS, and accept INTEGER*2 arguments.
ACOS Function
ACOS(arg) is a generic function that returns the arccosine of a REAL*4,
REAL*8, or
REAL*16 argument.
The value of arg must be less than or equal to one. The result is
expressed in radians and is the same data type as the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = ACOS(0.0628) | 1.5079550 |
| | |
| a = ACOS(0.0) | 1.5707964 |
| | |
| a = ACOS(0.0D0) | 1.570796326794897 |
| | |
---------------------------------------------------------
The specific function names are ACOS for REAL*4 arguments, DACOS for
REAL*8 arguments, and QACOS for REAL*16 arguments.
ACOSD Function
ACOSD(arg) is a generic function that returns the arccosine of a REAL*4,
REAL*8, or REAL*16 argument. The value of arg must be less than or equal
to one. The result is expressed in degrees and is the same data type as
the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = ACOSD(0.2) | 11.5370 |
| | |
| a = ACOSD(1.0) | 0.0 |
| | |
| a = ACOSD(0.8D0) | 36.86989764584401 |
| | |
---------------------------------------------------------
The specific function name is ACOSD for REAL*4 arguments, DACOSD for
REAL*8 arguments, and QACOSD for REAL*16 arguments.
ACOSH Function
ACOSH(arg) is a generic function that returns the hyperbolic arccosine of
a REAL*4, REAL*8, or REAL*16 argument.
The argument must be greater than or equal to one and less than or equal
to the maximum number allowed on your system. The result is the same
data type as the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = ACOSH(1.2) | 0.622362 |
| | |
| a = ACOSH(1.0) | 0.0 |
| | |
| a = ACOSH(1.0D0) | 0.0 |
| | |
---------------------------------------------------------
The specific function names are ACOSH for REAL*4 arguments, DACOSH for
REAL*8 arguments,
and QACOSH for REAL*16 arguments.
AINT Function
AINT(arg) is a generic function that truncates the fractional digits from
a REAL*4, REAL*8, or REAL*16 argument. The result is the the same data
type as the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = AINT(324.7892) | 324.0 |
| | |
| a = AINT(324.7892D2) | 32478.0 |
| | |
---------------------------------------------------------
The specific function names are AINT for REAL*4 arguments; DINT and DDINT
for REAL*8 arguments;
and QINT for REAL*16 arguments.
If arg is less than one, the result is zero. If arg is greater than one,
the result is the value with the same sign as arg with a magnitude that
does not exceed arg.
ANINT Function
ANINT(arg) is a generic function that returns the nearest whole number.
The argument can be REAL*4, REAL*8, or REAL*16. The result is INT (arg +
0.5) if arg is positive or zero, and is INT(arg - 0.5) if arg is
negative. The result is the same data type as the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = ANINT(-678.44) | -678.0 |
| | |
| a = ANINT(678.44) | 678.0 |
| | |
| a = ANINT(0.00) | 0.0 |
| | |
| a = ANINT(6.78 D1) | 68.0 |
| | |
---------------------------------------------------------
The specific function names are ANINT for REAL*4 arguments, DNINT for
REAL*8 arguments, and QNINT for REAL*16 arguments.
ASIN Function
ASIN(arg) is a generic function that returns the arcsine of a REAL*4,
REAL*8, or REAL*16 argument. The value of arg must be less than or equal
to one. The result is expressed in radians and is the same data type as
the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = ASIN(0.30) | 0.304692 |
| | |
| a = ASIN(0.30D0) | 0.3046926540153975 |
| | |
---------------------------------------------------------
The specific function names are ASIN for REAL*4 arguments, DASIN for
REAL*8 arguments, and QASIN for REAL*16 arguments.
ASIND Function
ASIND(arg) is a generic function that returns the arcsine of a REAL*4,
REAL*8, or REAL*16 argument. The value of arg must be less than or equal
to one. The result is expressed in degrees and is the same data type as
the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = ASIND(0.30) | 17.4576 |
| | |
| a = ASIND(0.30D0) | 17.45760312372209 |
| | |
---------------------------------------------------------
The specific function names are ASIND for REAL*4 arguments, DASIND for
REAL*8 arguments, and QASIND for REAL*16 arguments.
ASINH Function
ASINH(arg) is a generic function that returns the hyperbolic arcsine of a
REAL*4, REAL*8, or REAL*16 argument; the result is the same data type as
the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = ASINH(0.30) | 0.2956731 |
| | |
| a = ASINH(0.30D0) | 0.295673047563423 |
| | |
---------------------------------------------------------
The specific function names are ASINH for REAL*4 arguments, DASINH for
REAL*8 arguments, and QASINH for REAL*16 arguments.
ATAN Function
ATAN(arg) is a generic function that returns the arctangent of a REAL*4,
REAL*8, or REAL*16 argument. The result is expressed in radians and is
the same data type as the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = ATAN(1.0) | 0.7853982 |
| | |
| a = ATAN(3.141592653D0) | 1.262627255624651 |
| | |
---------------------------------------------------------
The specific function names are ATAN for REAL*4 arguments, DATAN for
REAL*8 arguments, and QATAN for REAL*16 arguments.
ATAN2 Function
ATAN2(arg1,arg2) is a generic function that returns the arctangent of
arg1/arg2. The arguments can be REAL*4, REAL*8, or REAL*16. The result
is expressed in radians and is the same data type as the arguments. The
arguments cannot both be zero.
Examples
---------------------------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------------------------
| | |
| a = ATAN2(1.0, 2.0) | 0.4636476 |
| | |
| a = ATAN2(3.141592653D0, 1.0D0) | 1.262627255624651 |
| | |
---------------------------------------------------------------------------
The specific function names are ATAN2 for REAL*4 arguments, DATAN2 for
REAL*8 arguments,
and QATAN2 for REAL*16 arguments.
ATAND Function
ATAND(arg) is a generic function that returns the arctangent of a REAL*4,
REAL*8, or REAL*16 argument. The result is expressed in degrees and is
the same data type as the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = ATAND(1.0) | 45.0 |
| | |
| a = ATAND(2.5D0) | 68.19859051364820 |
| | |
---------------------------------------------------------
The specific function names are ATAND for REAL*4 arguments, DATAND for
REAL*8 arguments, and QATAND for REAL*16 arguments.
ATAN2D Function
ATAN2D(arg1,arg2) is a generic function that returns the arctangent of
arg1/arg2. The arguments can be REAL*4, REAL*8, or REAL*16. The result
is expressed in degrees and is the same data type as the arguments. The
arguments cannot both be zero.
Examples
---------------------------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------------------------
| | |
| a = ATAN2D(1.0, 2.0) | 26.5651 |
| | |
| a = ATAN2D(2.0D0, 1.0D0) | 63.43494882292201 |
| | |
---------------------------------------------------------------------------
The specific function names are ATAN2D for REAL*4 arguments, DATAN2D for
REAL*8 arguments, and QATAN2D for REAL*16 arguemnts.
ATANH Function
ATANH(arg) is a generic function that returns the hyperbolic arctangent
of a REAL*4, REAL*8, or REAL*16 argument. The value of arg must be less
than one. The result is the same data type as the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = ATANH(0.30) | 0.3095196 |
| | |
| a = ATANH(0.30D0) | 0.309519604203112 |
| | |
---------------------------------------------------------
The specific function names are ATANH for REAL*4 arguments, DATANH for
REAL*8 arguments, and QATANH for REAL*16 arguments.
BADDRESS Function
BADDRESS(arg) is a generic function that returns the byte address of arg
as an integer of the same size as the address. arg may be of any type.
BADDRESS(arg) may not be passed as an actual argument.
Examples
---------------------------------------------------------------------------
| | |
| Function Call | Value Returned to i |
| | |
---------------------------------------------------------------------------
| | |
| i = BADDRESS(i) | Address of integer variable i. |
| | |
| i = BADDRESS(char) | Address of CHARACTER*9 variable char. |
| | |
| i = BADDRESS(log) | Address of logical variable log. |
| | |
| i = BADDRESS(cmplxarr) | Address of complex array cmplxarr. |
| | |
---------------------------------------------------------------------------
There are no specific function names for BADDRESS.
As an extension to the FORTRAN 77 standard, %LOC returns the address of
arg the same as BADDRESS. arg can be a variable, an array element, an
array, a character substring, or external procedure.
BTEST Function
BTEST(arg1, arg2) is a generic function that tests individual bits of
storage. The arguments are INTEGER*4 and the result is LOGICAL*4. If
the arg2th bit of arg1 is equal to one, the result is true. If the
arg2th bit is equal to zero, the result is false. If arg2 is greater
than or equal to the bit size of arg1, the result is false. Bit
positions are numbered right to left, with the rightmost bit numbered
zero.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to i |
| | |
---------------------------------------------------------
| | |
| i = BTEST(3,0) | .TRUE. |
| | |
| i = BTEST(0,0) | .FALSE. |
| | |
| i = BTEST(0,3) | .FALSE. |
| | |
| i = BTEST(4,1) | .FALSE. |
| | |
---------------------------------------------------------
The specific function names are BTEST and BJTEST for INTEGER*4 arguments
and HTEST and BITEST for INTEGER*2 arguments.
CHAR Function
CHAR(i) is a specific function that returns the character value in the
ith position of the ASCII collating sequence. The argument is INTEGER*4
and the result is character.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to c |
| | |
---------------------------------------------------------
| | |
| c = CHAR(97) | 'a' |
| | |
| c = CHAR(122) | 'z' |
| | |
| c = CHAR(53) | '5' |
| | |
---------------------------------------------------------
There is no generic name for this function.
CMPLX Function
CMPLX(arg) (or CMPLX(arg1,arg2)) is a specific function that performs
type conversion to a COMPLEX*8 value. CMPLX can have one or two
arguments.
If you specify one argument, the argument can be INTEGER*4, REAL*4,
REAL*8, REAL*16, or COMPLEX*8.
If you specify two arguments, the arguments must be the same type and
both must be INTEGER*4, REAL*4, REAL*8, or REAL*16.
If only one argument is used and it is not of type COMPLEX*8, the result
is COMPLEX*8, with REAL(arg) used as the real part and the imaginary part
equal to zero. For one argument of type COMPLEX*8, the result is the
same as the argument, or as much of the argument that can fit in a
COMPLEX*8 variable. For two arguments, arg1 and arg2, the result is
COMPLEX*8, with REAL(arg1) used as the real part and REAL(arg2) used as
the imaginary part.
Examples
---------------------------------------------------------------------------
| | |
| Function Call | Value Returned to c |
| | |
---------------------------------------------------------------------------
| | |
| c = CMPLX(1.0) | (1.0, 0.0) |
| | |
| c = CMPLX(1.0, 1.0) | (1.0, 1.0) |
| | |
| c = CMPLX(1, 0) | (1.0, 0.0) |
| | |
| c = CMPLX(3.141592653D0, 0.0D0) | (3.1415927, 0.0) |
| | |
---------------------------------------------------------------------------
There are no specific names for this function.
CONJG Function
CONJG(arg) is a generic function that returns the conjugate of a
COMPLEX*8 or COMPLEX*16 argument. The result is the same data type as
the argument.
Examples
-----------------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
-----------------------------------------------------------------
| | |
| a = CONJG(var1) | (3.0, 0.0), where var1 = (3.0, 0.0) |
| | |
| a = CONJG(var2) | (3.0, -1.0), where var2 = (3.0, 1.0) |
| | |
-----------------------------------------------------------------
The specific function names are CONJG for COMPLEX*8 arguments and DCONJG
for COMPLEX*16 arguments.
COS Function
COS(arg) is a generic function that returns the cosine of a REAL*4,
REAL*8,
REAL*16,
or COMPLEX*8 argument. The argument is expressed in radians. The result
is the same data type as the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = COS(0.0) | 1.0 |
| | |
| a = COS(0.0628) | 0.9980288 |
| | |
---------------------------------------------------------
The specific function names are COS for REAL*4 arguments, CCOS for
COMPLEX*8 arguments, DCOS for REAL*8 arguments, QCOS for REAL*16
arguments, and ZCOS and CDCOS for COMPLEX*16 arguments.
COSD Function
COSD(arg) is a generic function that returns the cosine of a REAL*4,
REAL*8, or REAL*16. The argument is expressed in degrees. The result is
the same data type as the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = COSD(60.0) | .50000 |
| | |
| a = COSD(0.0628D0) | .9999993993188778 |
| | |
---------------------------------------------------------
The specific function names are COSD for REAL*4 arguments, DCOSD for
REAL*8 arguments, and QCOSD for REAL*16 arguments.
COSH Function
COSH(arg) is a generic function that returns the hyperbolic cosine of a
REAL*4, REAL*8, or REAL*16 argument. The result is the same data type as
the argument.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = COSH(1.0) | 1.5430807 |
| | |
| a = COSH(3.0) | 10.06766 |
| | |
| a = COSH(3.0D0);; | 10.0676619957778 |
| | |
---------------------------------------------------------
The specific function names are COSH for REAL*4 arguments, DCOSH for
REAL*8 arguments,
and QCOSH for REAL*16 arguments.
DBLE Function
DBLE(arg) is a generic function that converts the argument to REAL*8.
The argument can be INTEGER*4, REAL*4, REAL*8, REAL*16, or COMPLEX*8.
For a REAL*16 argument, the result is as much precision of arg as a
REAL*8 item can contain. For an INTEGER*4 or REAL*4 argument, the result
is as much precision of the significant part of the argument as the
argument can provide. For a REAL*8 argument, the result is the argument.
For a REAL*16 argument, the result is as much precision of the
significant part of arg as a REAL*8 item can contain. For a COMPLEX*8
argument, the result is as much precision of the significant REAL*4 part
of the argument as the argument can provide.
Examples
----------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
----------------------------------------------------------
| | |
| a = DBLE(4) | 4.0 |
| | |
| a = DBLE(4.0) | 4.0 |
| | |
| a = DBLE(4.0D2) | 400.0 |
| | |
| a = DBLE(var1) | 4.0, where var1 = (4.00, 2) |
| | |
----------------------------------------------------------
The specific function names are DFLOAT for INTEGER*4 arguments and DBLEQ
for REAL*16 arguments.
DCMPLX Function
DCMPLX(arg) (or DCMPLX(arg1,arg2)) is a generic function that performs
type conversion to a COMPLEX*16 value. DCMPLX can have one or two REAL*8
arguments. If you specify one argument, the argument can be INTEGER*4,
REAL*4, REAL*8, REAL*16, or COMPLEX*8. If you specify two arguments, the
arguments must be of the same type and both must be INTEGER*4, REAL*4,
REAL*8, or REAL*16.
For one argument not of type COMPLEX*8, the result is COMPLEX*16, with
DBLE(arg) used as the real part and the imaginary part equal to zero.
For one argument, of type COMPLEX*8, the result is the same as the
argument. For two arguments, arg1 and arg2, the result is COMPLEX*16,
with DBLE(arg1) used as the real part and DBLE(arg2) used as the
imaginary part.
Examples
------------------------------------------------------------------
| | |
| Function Call | Value Returned to c |
| | |
------------------------------------------------------------------
| | |
| c = DCMPLX(1.0) | (1.0, 0.0) |
| | |
| c = DCMPLX(1.0, 0.0) | (1.0, 0.0) |
| | |
| c = DCMPLX(3.141592653D0, 0.0D0) | (3.1415927, 0.0) |
| | |
------------------------------------------------------------------
There are no specific names for this function.
DIM Function
DIM(arg1,arg2) is a generic function that returns a positive difference.
The arguments must be the same data type and can be INTEGER*4, REAL*4,
REAL*8, or REAL*16. The result is the same type as the arguments. The
result is (arg1 - arg2) if arg1 is greater than arg2. The result is zero
if arg1 is less than or equal to arg2.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------
| | |
| a = DIM(56.9, 45.4) | 11.5 |
| | |
| a = DIM(45.4, 56.9) | 0.0 |
| | |
| a = DIM(45.4, 45.4) | 0.0 |
| | |
---------------------------------------------------------
The specific function names are DIM for REAL*4 arguments, DDIM for REAL*8
arguments, QDIM for REAL*16 arguments, IDIM and JIDIM for INTEGER*4
arguments, and HDIM and IIDIM for INTEGER*2 arguments. IDIM can also be
used as a generic name of HDIM, and accept INTEGER*2 arguments.
DNUM Function
DNUM(arg) is a specific function that returns the REAL*8 value
represented in the character string arg.
Blanks are not significant in the input string.
Examples
-------------------------------------------------------------------
| | |
| Function Call | Value Returned to d8 |
| | |
-------------------------------------------------------------------
| | |
| d8 = DNUM('123.5') | 123.5D0 |
| | |
| d8 = DNUM('-99.25') | -99.25D0 |
| | |
| d8 = DNUM('327.125E75') | 327.125D75 |
| | |
| d8 = DNUM(' 24 5 ') | 245D0 (blanks are ignored) |
| | |
-------------------------------------------------------------------
There is no generic name for this function.
DPROD Function
DPROD(arg1,arg2) is a specific function that returns the REAL*8 product
of two REAL*4 arguments (arg1 *arg2). The result is a REAL*8 number with
none of the fractional portion lost and is equal to DBLE(arg1) *
DBLE(arg2).
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to d |
| | |
---------------------------------------------------------
| | |
| d = DPROD(2.2, 2.2) | 4.840 |
| | |
| d = DPROD(1.0, 2.0) | 2.0 |
| | |
---------------------------------------------------------
There is no generic name for this function.
EXP Function
EXP(arg) is a generic function that returns an exponential result
(e**arg). The argument can be REAL*4, REAL*8, REAL*16, COMPLEX*8, or
COMPLEX*16. The result is the same data type as the argument.
Examples
-----------------------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
-----------------------------------------------------------------------
| | |
| a = EXP(3.0) | 20.08554 |
| | |
| a = EXP(1.5D1) | (3269017.37247211) |
| | |
| a = EXP(var) | (10.85226, 16.90140), where var = (3.0, 1.0) |
| | |
-----------------------------------------------------------------------
The specific function names are EXP for REAL*4 arguments, DEXP for REAL*8
arguments, QEXP for REAL*16 arguments, CEXP for COMPLEX*8 arguments, and
ZEXP and CDEXP for COMPLEX*16 arguments.
IAND Function
IAND(arg1,arg2) is a generic function that returns the logical product,
or bitwise AND, of two INTEGER*4 arguments. The result is INTEGER*4.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to i |
| | |
---------------------------------------------------------
| | |
| i = IAND(0, 0) | 0 |
| | |
| i = IAND(1, 0) | 0 |
| | |
| i = IAND(0, 1) | 0 |
| | |
| i = IAND(1, 1) | 1 |
| | |
---------------------------------------------------------
The specific function names are IAND and JIAND for INTEGER*4 arguments
and HIAND and IIAND for INTEGER*2 arguments.
IBCLR Function
IBCLR(arg1,arg2) is a generic function that returns arg1 with the arg2th
bit cleared (set to zero). If arg2 is greater than or equal to the bit
size of arg1, the result is equal to arg1. The arguments and result are
INTEGER*4.
Bit positions are numbered from right to left, with the rightmost (least
significant) bit numbered zero.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to i |
| | |
---------------------------------------------------------
| | |
| i = IBCLR(3, 4) | 3 |
| | |
| i = IBCLR(1, 2) | 1 |
| | |
| i = IBCLR(1, 0) | 0 |
| | |
---------------------------------------------------------
The specific function names are IBCLR and JIBCLR for INTEGER*4 arguments
and HBCLR and IIBCLR for INTEGER*2 arguments.
IBITS Function
IBITS(arg1, arg2, arg3) is a generic function that extracts a subfield of
arg3 bits in length from arg1, starting with bit position arg2 and
extending left arg3 bits. The arguments and result are INTEGER*4. The
extracted bits are right-justified in the result with the remaining bits
set to zero. The value of (arg2 + arg3) must be less than or equal to 16
if arg1 is INTEGER*2, or 32 if arg1 is INTEGER*4.
Bit positions are numbered from right to left, with the rightmost (least
significant) bit numbered zero.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to i |
| | |
---------------------------------------------------------
| | |
| i = IBITS(3, 4, 8) | 0 |
| | |
| i = IBITS(16, 4, 8) | 1 |
| | |
| i = IBITS(12, 2, 2) | 3 |
| | |
---------------------------------------------------------
The specific function names are IBITS and JIBITS for INTEGER*4 arguments
and HBITS and IIBITS for INTEGER*2 arguments.
IBSET Function
IBSET(arg1,arg2) is a generic function that returns the value of arg1
with the arg2th bit set to 1. If arg2 is greater than or equal to the
bit size of arg1, the result is arg1. The arguments and the result are
INTEGER*4.
Bit positions are numbered from right to left, with the rightmost (least
significant) bit numbered zero.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to i |
| | |
---------------------------------------------------------
| | |
| i = IBSET(3, 4) | 19 |
| | |
| i = IBSET(1, 2) | 5 |
| | |
| i = IBSET(1, 0) | 1 |
| | |
---------------------------------------------------------
The specific function names are IBSET and JIBSET for INTEGER*4 arguments
and HBSET and IIBSET for INTEGER*2 arguments.
ICHAR Function
ICHAR(arg) is a specific function that converts a character argument to
an INTEGER*4 value. The result depends on the collating position of the
argument in the ASCII collating sequence. If arg is longer than one
character, the first character is used.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to i |
| | |
---------------------------------------------------------
| | |
| i = ICHAR('a') | 97 |
| | |
| i = ICHAR('z') | 122 |
| | |
| i = ICHAR('5') | 53 |
| | |
---------------------------------------------------------
There is no generic name for this function.
IEOR Function
IEOR(arg1,arg2) is a generic function that returns the bitwise exclusive
OR of two INTEGER*4 arguments. The result is INTEGER*4.
Examples
---------------------------------------------------------
| | |
| Function Call | Value Returned to i |
| | |
---------------------------------------------------------
| | |
| i = IEOR(1, 0) | 1 |
| | |
| i = IEOR(1, 1) | 0 |
| | |
| i = IEOR(0, 0) | 0 |
| | |
---------------------------------------------------------
An alternate generic function name is IXOR. The specific function names
are IEOR and JIEOR for INTEGER*4 arguments and HIEOR and IIEOR for
INTEGER*2 arguments.
IMAG Function
IMAG(arg) is a generic function that returns the imaginary part of a
complex number. The argument can be COMPLEX*8 or COMPLEX*16. For
COMPLEX*8 arguments, the result is REAL*4; for COMPLEX*16 arguments, the
result is REAL*8. A complex number is expressed as an ordered pair of
REAL*4 or REAL*8 numbers in the form (ar,ai), where ar is the REAL*4 part
and ai is the imaginary part. The result is the REAL*4 value of ai.
Examples
---------------------------------------------------------------------------
| | |
| Function Call | Value Returned to a |
| | |
---------------------------------------------------------------------------
| | |
| a = IMAG(var1) | (0.00, where var1 = (25.058, 0.0) |
| | |
| a = IMAG(var2) | (3.5, where var2 = (25.3, 3.5) |
| | |
| a = IMAG(var3) | (3.5, where var3 = (25.3D0, 3.5D0) |
| | |
---------------------------------------------------------------------------
The specific function names are AIMAG for COMPLEX*8 arguments, and DIMAG
for COMPLEX*16 arguments.
INDEX Function
INDEX(arg1,arg2) is a specific function that returns the location of
substring arg2 within string arg1. Both arguments must be character
strings. If string arg2 occurs as a substring within string arg1, the
result is an INTEGER*4 indicating the starting position of the substring
arg2 within arg1. The character positions are numbered from left to
right with the leftmost character numbered 1. If arg2 does not occur as
a substring, the result is zero. If arg2 occurs more than once within
arg1, the result is the starting position of the first occurrence. If
the length of arg1 is less than the length of arg2, the result is zero.
Examples
-------------------------------------------------------------------
| | |
| Function Call | Value Returned to i |
| | |
-------------------------------------------------------------------
| | |
| i = INDEX('ABCD', 'BC') | 2 |
| | |
| i = INDEX('10552', '5') | 3 |
| | |
| i = INDEX('ABC', 'XY') | 0 |
| | |
| i = INDEX('ABC', 'abc') | 0 |
| | |
-------------------------------------------------------------------
There is no generic name for this function.
MPE/iX 5.0 Documentation