Hi,

Thanks for the response.

While digging, I found following results,

1. result for (((( $V1 * $V2 )+( $V3 * $V4 )+( $V5 * $V6 ))div( $V1 + $V3 + $V5 ))) is "0.08915" 

2.result for (((( $V1 * $V2 )+( $V3 * $V4 )+( $V5 * $V6 ))div( $V1 + $V3 + $V5 ))*10000) is "891.4999999999999"

Hence while multiplying 1 with 10000 ideally it should give 891.5.

Thanks,
​​
Prasad Gavhane.

On Mon, Jul 4, 2016 at 1:16 PM, Christian Grün <christian.gruen@gmail.com> wrote:
Hi Prasad,

The difference is here:

> let $V2 := 0.0926

This value is of type xs:decimal.

  <V2>0.0926</V2>

This value is untyped, and implicitly converted to a double (not a
decimal) value when being included in an arithmetic expression. As the
following example shows…

  4 - 3.1, 4 - 3.1e0

…It’s often a difference if you work with decimals or doubles.

In your case, it may be best to explicitly convert your values before
doing the computations:

  let $V1 := xs:decimal(data/V1)
  let $V2 := xs:decimal(data/V2)
  let $V3 := xs:decimal(data/V3)
  let $V4 := xs:decimal(data/V4)
  let $V5 := xs:decimal(data/V5)
  let $V6 := xs:decimal(data/V6)
  let $V7 := xs:decimal(data/V7)
  return round(((( $V1 * $V2 )+( $V3 * $V4 )+( $V5 * $V6 ))div( $V1 +
$V3 + $V5 ))*10000)

Hope this helps,
Christian