IBM Support

PM41723: ROUND() REPORTS 'DIGITS < 0' FOR ARGUMENT BETWEEN 0 AND 0.1, AND RETURNS INCORRECT RESULT FOR ARGUMENT BETWEEN 0.1 AND 1.0

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • If the argument to the round function is greater than zero,
    but less than 0.1, the processor reports the error message
    "Digits < 0".  If the argument to the function is greater than
    or equal to 0.1 and less than 1, the processor returns the
    value of the argument as the result of the function, rather
    than the rounded result.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  Users of the XML API for IBM WebSphere      *
    *                  Application Server V8.0                     *
    ****************************************************************
    * PROBLEM DESCRIPTION: For arguments to the fn:round function  *
    *                      in the range 0 to 1, the processor      *
    *                      sometimes reports the error "Digits <   *
    *                      0" and sometimes returns the argument   *
    *                      as the result of the function,          *
    *                      instead of rounding correctly           *
    ****************************************************************
    * RECOMMENDATION:  Install a fix pack that contains this APAR. *
    ****************************************************************
    For an argument of type xs:float, xs:double or xs:decimal, the
    implementation of the fn:round function always represents the
    value as a java.math.BigDecimal object.  It then rounds that
    BigDecimal value using the BigDecimal.round method, supplying
    a java.math.MathContext whose precision is equal to the
    precision of the argument minus the absolute value of its
    scale.
    
    For all values whose absolute value is greater than or equal
    to one, that method of calculating the absolute value is
    correct.
    
    However, for a value that is greater than zero but less than
    0.1, that yields a negative value, and constructing a
    MathContext with a precision less than zero results in a Java
    Exception containing the message, "Digits < 0".  For a value
    that is greater than or equal to 0.1, but less than one, that
    formula yields a MathContext whose precision is zero, which
    indicates to the BigDecimal.round function that no rounding
    should be performed, which results in the argument being
    returned as the result as the fn:round function
    

Problem conclusion

  • The problem was resolved by changing the implementations of
    the fn:round function for values of type xs:float or xs:double
    to be a more efficient, correct algorithm that is specific to
    values of those floating point types, rather representing such
    values as Java BigDecimal objects.
    
    In the case of values of type xs:decimal, the implementation
    of fn:round was divided into three cases:  if the value is less
    than 0.5 and greater than or equal to -0.5, the implementation
    returns the result of 0; if the absolute value is less than
    one, and the value is greater than or equal to 0.5 or less
    than -0.5, the implementation returns the result of one, for
    positive values, or negative one, for negative values;
    otherwise, the implementation computes the result using the
    existing technique of using the BigDecimal.round method.
    
    The fix for this APAR is currently targeted for inclusion in
    fix pack 8.0.0.1.  Please refer to the Recommended Updates
    page for delivery information:
    http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
    

Temporary fix

Comments

APAR Information

  • APAR number

    PM41723

  • Reported component name

    WEBSPHERE APP S

  • Reported component ID

    5724J0800

  • Reported release

    800

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2011-06-15

  • Closed date

    2011-06-15

  • Last modified date

    2011-06-28

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

    PM33860

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

Fix information

  • Fixed component name

    WEBSPHERE APP S

  • Fixed component ID

    5724J0800

Applicable component levels

  • R800 PSY

       

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"8.0","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
27 October 2021