IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  IS_7-1-1_Flow_Fix1

    Posted 11/25/08 08:24 PM

    Part of the subject fix includes:

    [begin]
    1-1TQVWG
    The pub.math:multiplyFloats service returns values without
    rounding them correctly.

    On Intel platforms (Windows or Linux), the
    pub.math:multiplyFloats service returns values with too many
    digits after the decimal point for input values that end in
    .20 or .30. For example, if 3 and 13.20 are supplied as inputs,
    the returned value is 39.599999999999994 instead of 39.60.

    This issue is specific to Java on Intel platforms. To remedy this
    issue, the pub.math:multiplyFloats service now uses the
    java.math.BigDecimal implementation, which adds the ability to
    round the values correctly.
    [end]

    This appears to be a misunderstanding of binary floating point. For example, the decimal value of 0.1 is a repeater fraction 0.0001100110011…

    Floating point by its nature is inexact (inaccurate). Common “fixes” are to use rounding techniques.

    For a more thorough explanation, refer to these sites:

    http://docs.sun.com/source/806-3568/ncg_goldberg.html

    This is not a Java nor an Intel problem. It is a binary representation issue. I’m not sure who might lurking on these forums (this my first venture into this community) but my recommendation is:

    1. Restore mulitplyFloats to its prior (and correct) operation which should not include any rounding (or use of BigDecimal). Float/double should not be used when accuracy is necessary (monetary calculations, for example).

    2. Add a set of decimal services, such as addDecimals, multipleDecimals, etc. (perhaps using BigDecimal or other class for implementation) for proper decimal behavior.


    #Integration-Server-and-ESB
    #webMethods