Forum Discussion

ztilleto's avatar
ztilleto
New Contributor
10 years ago

xpath Decimal Error calculation error

I was doing a rounding calculation test for a testcase I am working on.
Where I do a shift to 2 decimals on a float response by *100 round and then /100 again. This however gives me an odd response, where it seems that there are a rounding error somewhere in the SOAP UI system.

If I only do the *100 round. It shows correctly. If I do *100 round /10 it shows correct, however if I do /100 it gives an decimal problem where it adds 0.000000000000005 to the result.

This is on Soap UI Pro 5.1.1. XPath result.
XPathContains comparison failed for path [declare namespace a='http://NordicInsuranceSoftware.WebServices'; declare namespace ns1='http://NordicInsuranceSoftware.WebServices/PolicySales'; round(//ns1:AnswerQuestionResponse[1]/ns1:AnswerQuestionResult[1]/a:Policies[1]/a:PolicyDraftModel[1]/a:Insured[1]/a:InsuredModel[2]/a:CalculationResults[1]/a:CalculationResultModel[4]/a:Value[1]*100)*0.01], expecting [51.62], actual was [51.620000000000005]

2 Replies