Using arithmetic
The following steps should be performed using integer arithmetic:
- Select one of the following values, according to the type of encoding required:
- 1 for the binary integer encoding
- 16 for the packed decimal integer encoding
- 256 for the floating point encoding
Call the value
A.
- Divide the value of the MDENC field by A; call the result
B.
- Divide
B by 16; call the result C.
- Multiply
C by 16 and subtract from B; call the result D.
- Multiply
D by A; call the result E.
E is the encoding required, and can be tested for equality with each of the values that is valid for that type of encoding.