Wrong Results Produced By The Sum(XPATH) Function In Script (Doc ID 1555513.1)

Last updated on OCTOBER 18, 2016

Applies to:

Oracle Utilities Framework - Version 2.2.0 and later
Information in this document applies to any platform.

Symptoms

 Created a simple BPA to test a function which is not working in the way it is supposed to be

We tried to do 2108.39+2108.39+1330.8+189.83+4561.12+480.55 and the desired result should be 10779.08, but we get a result of 10779.079999999998 when using the sum function

A simple BPA with a step type of Edit data with the steps as below:

move 'true' to "parm/+listofpay/use";
move '2108.39' to "parm/listofpay[last()]/amt";
move 'true' to "parm/+listofpay/use";
move '2108.39' to "parm/listofpay[last()]/amt";
move 'true' to "parm/+listofpay/use";
move '1330.8' to "parm/listofpay[last()]/amt";
move 'true' to "parm/+listofpay/use";
move '189.83' to "parm/listofpay[last()]/amt";
move 'true' to "parm/+listofpay/use";
move '4561.12' to "parm/listofpay[last()]/amt";
move 'true' to "parm/+listofpay/use";
move '480.55' to "parm/listofpay[last()]/amt";
//move "sum(parm/listofpay[use='true']/amt)" to "parm/totamt";
move "sum(parm/listofpay/amt)" to "parm/totamt";

The Schema Set up is as below:
<schema>
<totamt dataType="number"/>
<listofpay type="list">
<amt dataType="number"/>
<use dataType="boolean"/>
</listofpay>
</schema>

When we try to print the parm/totamt it is printing it as 10779.079999999998, though all the schema nodes are declared as type number, we get these strange results.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms