IBM Support

IV84130: BIGDECIMAL.STRIPTRAILINGZEROS() DOESN'T RETURN BIGDECIMAL.ZERO WHEN IT IS NUMERICALLY EQUAL TO ZERO

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Error Message: Below standalone testcase can recreate the issue.
    import java.math.BigDecimal;
    public class BigDecimalTest {
    public static void main(String<OSB><CSB> args) {
      BigDecimal zero = new BigDecimal("0.0000000000000000");
      System.out.println("BD1 = "+zero.stripTrailingZeros());
      System.out.println("BD1 = "+BigDecimal.ZERO);
      if( zero.stripTrailingZeros().equals(BigDecimal.ZERO) )
          System.out.println("Test Passed");
      else
          System.out.println("Test failed");
      }
    }
    Output:
    BD1 = 0E-16
    BD1 = 0
    Test failed
    .
    Stack Trace: N/A
    .
    N/A
    

Local fix

  • N/A
    

Problem summary

  • When the BigDecimal is "0.0000000000000000",
    BigDecimal.stripTrailingZeros() simply returns its original
    value. However the expected return value is BigDecimal.ZERO.
    Refer to Oracle's implementation, it also returns
    BigDecimal.ZERO.
    

Problem conclusion

  • If this BigDecimal is numerically equal to zero, then
    BigDecimal.ZERO is returned.
    .
    This APAR will be fixed in the following Java Releases:
       8    SR3       (8.0.3.0)
       7.1  SR4  FP45 (7.1.4.45)
       7.0  SR10 FP45 (7.0.10.45)
    .
    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

  • N/A
    

Comments

APAR Information

  • APAR number

    IV84130

  • 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

    2016-04-25

  • Closed date

    2016-04-25

  • Last modified date

    2019-02-26

  • 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

  • R800 PSY

       UP

[{"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:
21 February 2022