Op Code (Hex) | Extender | Operand 1 | Operand 2 | Operand 3 | Operand [4-5] |
---|---|---|---|---|---|
CMF1 100B |
| Receiver | Controls | Source |
|
| |||||
CMF1B 1C0B | Branch options | Receiver | Controls | Source | Branch targets |
| |||||
CMF1I 180B | Indicator options | Receiver | Controls | Source | Indicator targets |
Operand 2: Character(2) scalar.
Operand 3: Numeric scalar.
Operand 4-5:
The mathematical function, indicated by the controls operand, is performed on the source operand value and the result is placed in the receiver operand.
The calculation is always done in floating-point.
The result of the operation is copied into the receiver operand.
The controls operand must be a character scalar
that specifies which
mathematical function is to be
performed. It must be at least 2 bytes in length and has
the following format:
Offset | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Dec | Hex |
| Field Name |
| Data Type and Length | ||||||||
0 | 0 |
| Controls operand |
| Char(2) | ||||||||
|
|
|
| ||||||||||
2 | 2 |
| --- End --- |
|
|
The controls operand mathematical functions are as follows:
The sine of the numeric value of the source operand, whose value is considered to be in radians, is computed and placed in the receiver operand.
The result is in the range:
-1 <= SIN(x) <= 1
The arc sine of the numeric value of the source operand is computed and the result (in radians) is placed in the receiver operand.
The result is in the range:
-pi/2 <= ASIN(x) <= +pi/2
The cosine of the numeric value of the source operand, whose value is considered to be in radians, is computed and placed in the receiver operand.
The result is in the range:
-1 <= COS(x) <= 1
The arc cosine of the numeric value of the source operand is computed and the result (in radians) is placed in the receiver operand.
The result is in the range:
0 <= ACOS(x) <= pi
The tangent of the source operand, whose value is considered to be in radians, is computed and the result is placed in the receiver operand.
The result is in the range:
-infinity <= TAN(x) <= +infinity
The arc tangent of the source operand is computed and the result (in radians) is placed in the receiver operand.
The result is in the range:
-pi/2 <= ATAN(x) <= pi/2
The cotangent of the source operand, whose value is considered to be in radians, is computed and the result is placed in the receiver operand.
The result is in the range:
-infinity <= COT(x) <= +infinity
The computation e power (source operand) is performed and the result is placed in the receiver operand.
The result is in the range:
0 <= EXP(x) <= +infinity
The natural logarithm of the source operand is computed and the result is placed in the receiver operand.
The result is in the range:
-infinity <= LN(x) <= +infinity
The sine hyperbolic of the numeric value of the source operand is computed and the result (in radians) is placed in the receiver operand.
The result is in the range:
-infinity <= SINH(x) <= +infinity
The cosine hyperbolic of the numeric value of the source operand is computed and the result (in radians) is placed in the receiver operand.
The result is in the range:
+1 <= COSH(x) <= +infinity
The tangent hyperbolic of the numeric value of the source operand is computed and the result (in radians) is placed in the receiver operand.
The result is in the range:
-1 <= TANH(x) <= +1
The inverse of the tangent hyperbolic of the numeric value of the source operand is computed and the result (in radians) is placed in the receiver operand.
The result is in the range:
-infinity <= ATANH(x) <= +infinity
The square root of the numeric value of the source operand is computed and placed in the receiver operand.
The result is in the range:
0 <= SQRT(x) <= +infinity
The following chart shows some special cases for certain arguments
(X) of the different mathematical
functions which take one argument value.
X | Masked | UnMasked |
|
|
|
| Maximum | Minimum |
|
---|---|---|---|---|---|---|---|---|---|
Function | NaN | NaN | +Infinity | -Infinity | +0 | -0 | Value | Value | Other |
Sine | g | A(e) | A(f) | A(f) | +0 | -0 | A(1,f) | A(1,f) | B(3) |
Arc sine | g | A(e) | A(f) | A(f) | +0 | -0 | A(6,f) | A(6,f) | - |
Cosine | g | A(e) | A(f) | A(f) | +1 | +1 | A(1,f) | A(1,f) | B(3) |
Arc cosine | g | A(e) | A(f) | A(f) | +pi/2 | +pi/2 | A(6,f) | A(6,f) | - |
Tangent | g | A(e) | A(f) | A(f) | +0 | -0 | A(1,f) | A(1,f) | B(3) |
Arc Tangent | g | A(e) | +pi/2 | -pi/2 | +0 | -0 | - | - | - |
Cotangent | g | A(e) | A(f) | A(f) | +inf | -inf | A(1,f) | A(1,f) | B(3) |
E Exponent | g | A(e) | +inf | +0 | +1 | +1 | C(4,a) | D(5,b) | - |
Logarithm | g | A(e) | +inf | A(f) | -inf | -inf | - | - | A(2,f) |
Sine hyperbolic | g | A(e) | +inf | -inf | +0 | -0 | - | - | - |
Cosine hyperbolic | g | A(e) | +inf | +inf | +1 | +1 | - | - | - |
Tangent hyperbolic | g | A(e) | +1 | -1 | +0 | -0 | - | - | - |
Arc tangent hyperbolic | g | A(e) | A(f) | A(f) | +0 | -0 | A(6,f) | A(6,f) | - |
Square root | g | A(e) | +inf | A(f) | +0 | -0 | - | - | A(2,f) |
Special cases for single argument math functions |
Capital letters in the chart indicate the exceptions, small letters indicate the returned results, and Arabic numerals indicate the limits of the arguments (X) as defined in the following lists:
A = | Floating-point invalid operand (hex 0C09) exception (no result stored if unmasked; if masked, occurrence bit is set) |
B = | Floating-point inexact result (hex 0C0D) exception (result is stored whether or not exception is masked) |
C = | Floating-point overflow (hex 0C06) exception (no result is stored if unmasked; if masked, occurrence bit is set) |
D = | Floating-point underflow (hex 0C07) exception (no result is stored if unmasked; occurrence bit is always set) |
a = | Result follows the rules that depend on round mode |
b = | Result is +0 or a denormalized value |
c = | Result is +infinity |
d = | Result is -infinity |
e = | Result is the masked form of the input NaN |
f = | Result is the system default masked NaN |
g = | Result is the input NaN |
inf = | Result is infinity |
1 = | | pi * 2**50 |=Hex 432921FB54442D18 |
2 = | Argument is in the range: -inf < x < -0 |
3 = | | pi * 2**26 |=Hex 41A921FB54442D18 |
4 = | 1n(2**1023) Hex 40862E42FEFA39EF |
5 = | 1n(2**-1021.4555)=Hex C086200000000000 |
6 = | Argument is in the range: -1 <= x <= +1 |
The following chart provides accuracy data for the mathematical functions that can be invoked by this instruction.
Function Name | Sample Selection | Accuracy data | |||||
---|---|---|---|---|---|---|---|
Relative Error(e) | Absolute Error(E) | ||||||
A | Range of x | D | MAX(e) | SD(e) | MAX(E) | SD(E) | |
Arc cosine | 9 | 0<=x<=3.14 | U |
|
| 8.26* 10**-14 | 2.11*10**-15 |
Arc sine | 10 | -1.57<=x<=1.57 | U | 1.02*10**-13 | 2.66*10**-15 |
|
|
Arc tangent | 1 | -pi/2<x<pi/2 | 1 |
|
| 3.33*10**-16 | 9.57*10**-17 |
Arc tangent hyperbolic | 14 | -3<=x<=3 | U |
|
| 1.06*10**-14 | 1.79*10**-15 |
Cosine |
| (See Sine below) |
|
|
|
|
|
Cosine hyperbolic |
| (See Sine Hyperbolic below) |
|
|
|
|
|
Cotangent | 11 | -10<=x<=100
.000001<=x<=.001 4000<=x<=4000000 | U
U U | 4.83*10**-16
4.36*10**-16 5.72*10**-16 | 1.48*10**-16
1.49*10**-16 1.46*10**-16 |
|
|
Exponential | 2 | -100<=x<=300 | U | 5.70*10**-14 | 1.13*10**-14 |
|
|
Natural Logarithm | 3 | 0.5<=x<=1.5 | U |
|
| 2.77*10**-16 | 8.01*10**-17 |
Natural Logarithm | 4 | -100<=x<=700 | E | 2.17*10**-16 | 7.37*10**-17 |
|
|
Sine cosine | 5 | -10<=x<=100
.000001<=x<=.001 4000<=x<=4000000 | U
U U |
|
| 2.22*10**-16
2.22*10**-16 2.22*10**-16 | 1.31*10**-16
1.56*10**-16 1.28*10**-16 |
Sine cosine | 6 | -10<=x<=100
.000001<=x<=.001 4000<=x<=4000000 | U
U U |
|
| 3.33*10**-16
4.33*10**-19 3.33*10**-16 | 8.39*10**-17
1.28*10**-19 8.17*10**-17 |
Sine/cosine hyperbolic | 12 | -100<=x<=300 | U | 6.31*10**-16 | 1.97*10**-16 |
|
|
Square root | 7 | -100<=x<=700 | E | 4.13*10**-16 | 1.27*10**-16 |
|
|
Tangent | 8 | -10<=x<=100
.000001<=x<=.001 4000<=x<=4000000 | U
U U | 4.59*10**-16
4.42*10**-16 4.77*10**-16 | 1.54*10**-16
1.44*10**-16 1.43*10**-16 |
3.25*10**-19
|
8.06*10**-20
|
Tangent hyperbolic | 13 | -100<=x<=300 | U | 8.35*10**-16 | 3.87*10**-17 | 2.22*10**-16 | 3.17*10**-17 |
Note:
Algorithm Notes:
Distribution Note:
| |||||||
Accuracy data for CMF1 mathematical functions |
The vertical columns in the accuracy data chart have the following meanings:
MAX(e) = | MAX( ABS((f(x) - g(x) ) / f(x))) where: MAX selects the largest of its arguments and ABS takes the absolute value of its argument. |
SD(e) = | SQR( (1/N) SUMSQ((f(x) - g(x) ) / f(x))) where: SQR takes the square root of its argument and SUMSQ takes the summation of the squares of its arguments over all of the test cases. |
MAX(E) = | MAX( ABS( f(x) - g(x) ) ) where: the operators are those defined above. |
SD(E) = | SQR( (1/N) SUMSQ( f(x) - g(x) ) ) where: the operators are those defined above. |
The following are limits that apply to the functions performed by this instruction.
The source and receiver operands must both be specified as floating-point with the same length (4 bytes for short format or 8 bytes for long format).
06 Addressing
08 Argument/Parameter
0C Computation
10 Damage Encountered
1C Machine-Dependent
20 Machine Support
22 Object Access
24 Pointer Specification
2C Program Execution
2E Resource Control Limit
32 Scalar Specification
36 Space Management
44 Protection Violation