IBM Support

IJ32356: BIGDECIMAL GIVES INCORRECT ARITHMETIC RESULTS FOR THE ADD AND SUBTRACT OPERATIONS ON THE RESULT OF A DIVIDE

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Error Message: N/A
    .
    Stack Trace: N/A
    .
    BigDecimal gives incorrect arithmetic results for the add and
    subtract operations on the result of a divide.
    

Local fix

  • This issue can be worked around by calling the
    "java.math.BigDecimal.precision()" method on the result of
    divide operation before the add and subtract operations.
    

Problem summary

  • BigDecimal gives incorrect arithmetic results for the add and
    subtract operations on the result of a divide
    

Problem conclusion

  • The BigDecimal code has been adjusted and the issue is fixed via
    a boolean System property
    "ibm.java.math.BigDecimal.useSmallerScaleBD". Default value of
    this property is "false". Set this property value to "true" via
    command line to apply this fix.
    .
    1) This issue happens with MathContext.DECIMAL32 and
    MathContext.DECIMAL64.
    2) This issue is seen when the return from BigDecimal.divide()
    is passed as an argument to either BigDecimal.add() or
    BigDecimal.subtract().
    Please check your code for this pattern.
    .
    .
    This APAR will be fixed in the following Java Releases:
       8    SR7 FP10  (8.0.7.10)
    .
    Contact your IBM Product's Service Team for these Service
    Refreshes and Fix Packs.
    For those running stand-alone, information about the available
    Service Refreshes and Fix Packs can be found at:
               https://www.ibm.com/developerworks/java/jdk/
    

Temporary fix

Comments

APAR Information

  • APAR number

    IJ32356

  • Reported component name

    JAVA CLASS LIBS

  • Reported component ID

    620700130

  • Reported release

    800

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2021-04-28

  • Closed date

    2021-11-04

  • Last modified date

    2023-07-03

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    JAVA CLASS LIBS

  • Fixed component ID

    620700130

Applicable component levels

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"8.0","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
03 July 2023