decimal to Cobol Numeric

Strange results occurring with the attached piece of code.  The CalcPerecntDotNet method is returning mixed results when you divide 100 by the following numbers 13 thru 15, 17 thru 19, 21 thru 24.  FYI, I stopped testing at 100.  The CalcPercentCobol method seems to work correctly.  Also it should be noted that the piece of code that is causing the problem is when I try to move the Decimal field to the Pic 9(03)v99 field using the set command. 

Below I provided the values 13 thru 24

passed value CalcPercentCobol CalcPercentDotNet
13 7.69 707.54
14 7.14 706.99
15 6.66 706.51
16 6.25 6.25
17 5.88 705.73
18 5.55 705.4
19 5.26 705.11
20 5 5
21 4.76 704.61
22 4.54 704.39
23 4.34 704.19
24 4.16 704.01

Tags:

  • Please create a support incident for this problem and reference my name in the description so that it is assigned to me.

    I will create an rpi for this behavior so that we can get it fixed.

    I can reproduce the problem using the following:

          working-storage section.
          01  mydecimal     decimal value 13.
          01  result        decimal.
          01  mynumber      pic 9(3)v99.
          procedure division.
               set result to 100 / mydecimal
               set mynumber to result

    Thanks.