Compute Math Function Using Two Input Values (CMF2)

Instruction Syntax

Op Code (Hex) Extender Operand 1 Operand 2 Operand 3 Operand 4 Operand [5-8]
CMF2 100C Receiver Controls Source 1 Source 2
CMF2B 1C0C Branch options Receiver Controls Source 1 Source 2 Branch targets
CMF2I 180C Indicator options Receiver Controls Source 1 Source 2 Indicator targets
Operand 1: Numeric variable scalar.

Operand 2: Character(2) scalar.

Operand 3: Numeric scalar.

Operand 4: Numeric scalar.

Operand 5-8:

  • Branch Form–Branch point, instruction pointer, relative instruction number, or absolute instruction number.
  • Indicator Form–Numeric variable scalar or character variable scalar.

Description:

The mathematical function, indicated by the controls operand, is performed on the source operand values and the result is placed in the receiver operand.

The calculation is always done in floating-point.

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 have the following format:

Offset  
Dec Hex Field Name Data Type and Length

0

0

Controls operand

Hex 0001 =
Power (x to the y)
All other values are reserved

Char(2)

2

2

--- End ---

 

The computation x power y, where x is the first source operand and y is the second source operand, is performed and the result is placed in the receiver operand.

The following chart shows some special cases for certain arguments of the power function (x**y). Within the chart, the capitalized letters X and Y refer to the absolute value of the arguments x and y; that is, X = |x| and Y = |y|.

  y=-inf y<0

odd integer

y<0

even integer

y<0

non-integer

y=-0.5 y=+0 or -0 y=+0.5 y>0

odd integer

y>0

even integer

y>0

non-integer

y=+inf y= Masked NaN y= UnMasked NaN
x=+inf +0 +0 +0 +0 +0 +1 +inf +inf +inf +inf +inf y VX(y)
x>+1 +0 +1 / x**Y +1 / x**Y +1 / x**Y +1 / SQRT(x) +1 SQRT(x) x**y x**y x**y +inf y VX(y)
x=+1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 y VX(y)
0<x<+1 +inf +1 / x**Y +1 / x**Y +1 / x**Y +1 / SQRT(x) +1 SQRT(x) x**y x**y x**y +0 y VX(y)
x=+0 ZD(+inf) ZD(+inf) ZD(+inf) ZD(+inf) ZD(+inf) +1 +0 +0 +0 +0 +0 y VX(y)
x=-0 ZD(+inf) ZD(-inf) ZD(+inf) ZD(+inf) Start of changeZD(+inf)End of change +1 Start of change+0End of change -0 +0 +0 +0 y VX(y)
x<0 VX(NaN) -1 / X**Y +1 / X**Y VX(NaN) VX(NaN) +1 VX(NaN) -(X**y) X**y VX(NaN) VX(NaN) y VX(y)
x=-inf VX(NaN) -0 +0 VX(NaN) VX(NaN) +1 VX(NaN) -inf +inf VX(NaN) VX(NaN) y VX(y)
x= Masked Nan x x x x x x x x x x x x or y VX(x or y)
x= Unmasked Nan VX(x) VX(x) VX(x) VX(x) VX(x) VX(x) VX(x) VX(x) VX(x) VX(x) VX(x) VX(x or y) VX(x or y)
Special cases of the power function (x**y)

These special functions denote floating point exceptions, and indicate what result is produced if the exception is disabled:

ZD(value)
Floating-point zero divide (hex 0C0E) exception. The function result is the specified value.
VX(value)
Floating-point invalid operand (hex 0C09) exception. The function result for VX(NaN) is the system default masked NaN. The function result for any other value is the masked equivalent of the specified (NaN) value.

The following chart provides accuracy data for the mathematical function that can be invoked by this instruction.

Sample Selection Accuracy data
x y MAX(e) SD(e)
1/3 -345 <= y <= 330 4.99 * 10**-16 1.90 * 10**-16
.75 -1320 <= y <= 1320 2.96 * 10**-16 2.39 * 10**-16
.9 -3605 <= y <= 3605 1.23 * 10**-16 1.02 * 10**-16
10 -165 <= y <= 165 7.10 * 10**-16 3.18 * 10**-16
712 -57 <= y <= 57 1.75 * 10**-15 7.24 * 10**-16

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

  • Sample Selection: This column identifies the selection of samples taken for the power function. The algorithm used against the arguments, x and y, to gather the accuracy samples was a test for the anticipated relation where f(x) should equal g(x,y):

    where:

     f (x)= x
      g(x,y)= (x**y)**(1/y)
     

    An accuracy sample then, is an evaluation of the degree to which this relation held true.

    The range of argument values for x and y were selected such that x was held constant at a particular value and y was uniformly varied throughout a range of values which avoided overflowing or underflowing the result field. The particular values selected are indicated in the subcolumns entitled x and y.

  • Accuracy Data: The maximum relative error and standard deviation (root mean square) of the relative error are generally useful and revealing statistics. These statistics for the relative error, (e), are provided in the following subcolumns:
    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.

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

  • Positive–The algebraic value of the receiver operand is positive.
  • Negative–The algebraic value of the receiver operand is negative.
  • Zero–The algebraic value of the receiver operand is zero.
  • Unordered–The value assigned to the floating-point result is NaN.

Authorization Required

  • None

Lock Enforcement

  • None

Exceptions

  • 06 Addressing
    • 0601 Space Addressing Violation
    • 0602 Boundary Alignment
    • 0603 Range
  • 08 Argument/Parameter
    • 0801 Parameter Reference Violation
  • 0C Computation
    • 0C06 Floating-Point Overflow
    • 0C07 Floating-Point Underflow
    • 0C09 Floating-Point Invalid Operand
    • 0C0C Invalid Floating-Point Conversion
    • 0C0D Floating-Point Inexact Result
    • 0C0E Floating-Point Zero Divide
  • 10 Damage Encountered
    • 1004 System Object Damage State
    • 1044 Partial System Object Damage
  • 1C Machine-Dependent
    • 1C03 Machine Storage Limit Exceeded
  • 20 Machine Support
    • 2002 Machine Check
    • 2003 Function Check
  • 22 Object Access
    • 2201 Object Not Found
    • 2202 Object Destroyed
    • 2203 Object Suspended
    • 2208 Object Compressed
    • 220B Object Not Available
  • 24 Pointer Specification
    • 2401 Pointer Does Not Exist
    • 2402 Pointer Type Invalid
  • 2C Program Execution
    • 2C04 Branch Target Invalid
  • 2E Resource Control Limit
    • 2E01 User Profile Storage Limit Exceeded
    • 2E02 Security Audit Journal Failure
  • 32 Scalar Specification
    • 3201 Scalar Type Invalid
    • 3203 Scalar Value Invalid
  • 36 Space Management
    • 3601 Space Extension/Truncation
  • 44 Protection Violation
    • 4401 Object Domain or Hardware Storage Protection Violation
    • 4402 Literal Values Cannot Be Changed