I have noticed something strange. This is my XML
<Items>
<Item>
<Name>A</Name>
<Amount>0.0012</Amount>
<Quantity>17</Quantity>
<TotalAmount>0.0204</TotalAmount>
</Item>
<Item>
<Name>B</Name>
<Amount>1</Amount>
<Quantity>2</Quantity>
<TotalAmount>2</TotalAmount>
</Item>
<Item>
<Name>C</Name>
<Amount>3</Amount>
<Quantity>2</Quantity>
<TotalAmount>6</TotalAmount>
</Item>
</Items>
And this is the XPath that I used
/Items/Item[((Amount * Quantity) != TotalAmount)]/Name
This XPath had to print the name of the item whose TotalAmount!= Product(Amount, Quantity).
I get the value A. But I do not understand why this is happening Because 0.0012 * 17 = 0.0204
And if I remove Item 'A', then I do not get a result.
The same goes for newer versions of XPath as well
for $x in /Items/Item[((Amount * Quantity) != TotalAmount)] return $x/Name
I'm using Saxon 9 in Java.
Can someone explain why this is happening.