title: COBOL COMPUTE calculation
body: <p>I am executing a standalone Enterprise COBOL program with the below calculation. I am having a COMPUTE with multiple operations and another with the full calculation split up. But the results are different(the last 4 digits) in both cases.</p>
  
  <p>I have manually calculated these using a calculator and the result matches the one with the split up COMPUTE statements. I have tried the calculations by using the entire answer at intermediate results and use only 15 digits of the final answer and also using only 15 digits at all intermediate steps(without rounding). But none of these results match with the combined COMPUTE result. </p>
  
  <p>Could someone help me understand why there is such a difference.</p>
  
  <pre><code>      05 WS-A              PIC S9(3)V9(15) COMP.
        05 WS-B              PIC S9(3)V9(15) COMP.
        05 WS-C              PIC S9(3)V9(15) COMP.
        05 WS-D              PIC S9(3)V9(15) COMP.
        05 WS-E              PIC S9(3)V9(15) COMP.
        05 WS-RES            PIC S9(3)V9(15) COMP.  
        05 RES-DISP          PIC -9(2).9(16).
  
         MOVE 3.56784                TO WS-A.
         MOVE 1.3243284234           TO WS-B.
         MOVE .231433897121334834    TO WS-C.
         MOVE 9.3243243213           TO WS-D.
         MOVE 7.0                    TO WS-E.   
  
         COMPUTE WS-RES = WS-A / WS-B.
         MOVE WS-RES TO RES-DISP.
         COMPUTE WS-RES = WS-RES / WS-C.
         MOVE WS-RES TO RES-DISP.   
         COMPUTE WS-RES = WS-RES / (WS-D + WS-E).
         MOVE WS-RES TO RES-DISP.   
         COMPUTE WS-RES = WS-RES * (WS-C - WS-A) 
         MOVE WS-RES TO RES-DISP.   
         COMPUTE WS-RES = WS-RES + WS-E ** WS-B 
         MOVE WS-RES TO RES-DISP.   
         COMPUTE WS-RES = WS-RES + WS-D.
         MOVE WS-RES TO RES-DISP.   
  </code></pre>
  
  <p>Result of last compute = 20.1030727225138740   </p>
  
  <pre><code>       COMPUTE WS-RES = WS-A / WS-B / WS-C /
                 (WS-D + WS-E) * (WS-C - WS-A) +
                 WS-E ** WS-B + WS-D.
         MOVE WS-RES TO RES-DISP.   
  </code></pre>
  
  <p>Result of combined compute = 20.1030727225138680</p>