Compute Math Function Using One Input Value (CMF1)


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 1: Numeric variable scalar.

Operand 2: Character(2) scalar.

Operand 3: Numeric scalar.

Operand 4-5:

Description

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)



Hex 0001 = Sine
Hex 0002 = Arc sine
Hex 0003 = Cosine
Hex 0004 = Arc cosine
Hex 0005 = Tangent
Hex 0006 = Arc tangent
Hex 0007 = Cotangent
Hex 0010 = Exponential function
Hex 0011 = Logarithm based e (natural logarithm)
Hex 0012 = Sine hyperbolic
Hex 0013 = Cosine hyperbolic
Hex 0014 = Tangent hyperbolic
Hex 0015 = Arc tangent hyperbolic
Hex 0020 = Square root
All other values are reserved



2 2
--- End ---

The controls operand mathematical functions are as follows:

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:

  1. f(x) = x, and g(x) = ATAN(TAN(x)).

  2. f(x) = e**x, and g(x) = e**(1n(e**x)).

  3. f(x) = 1n(x), and g(x) = 1n(e**(1n(x))).

  4. f(x) = x, and g(x) = 1n(e**x).

  5. Sum of squares algorithm. f(x) = 1, and g(x) = SIN(x))**2 + (COS(x))**2.

  6. Double angle algorithm. f(x) - SIN(2x), and g(x) = 2*(SIN(x)*COS(x)).

  7. f(x) = e(**x, and g(x) = (SQR(e**x))**2.

  8. f(x) = TAN(x), and g(x) = SIN(x) / COS(x).

  9. f(x) = x, and g(x) = ACOS(COS(x)).

  10. f(x) = x, and g(x) = ASIN(SIN(x)).

  11. f(x) = COT(x), and g(x) = COS(x) / SIN(x).

  12. f(x) = SINH(2x), and g(x) = 2*(SINH(x)*COSH(x)).

  13. f(x) = TANH(x), and g(x) = SINH(x) / COSH(x).

  14. f(x) = x, and g(x) = ATANH(TANH(x)).

Distribution Note:

  1. The sample input arguments were tangents of numbers, x, uniformly distributed between -pi/2 and +pi/2.
Accuracy data for CMF1 mathematical functions

The vertical columns in the accuracy data chart have the following meanings:

Limitations (Subject to Change)

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).

Resultant Conditions

Authorization Required

Lock Enforcement

Exceptions

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