Why is this simply 'x divided by Y' not calculating correctly?

From a JSON file I need to perform the following calculation; Cost / Quantity = Amt per quantity

In the example where im reciving and error. The calculation is 6.6/10 = 0.66 (should equal)
UiPath is returning 6.6/10=0.6599999999999999.

What is that all about? where are the 99999s coming from?

Im using

Convert.ToDouble(Currentrow(“cost”))/Convert.ToDouble(Currentrow(“quantity”))

@Waterfowl_Waterfowl_hunte,

You will have to round it off using Math.Round function. Use this code:

Math.Round(Convert.ToDouble(Currentrow("cost"))/Convert.ToDouble(Currentrow("quantity")),2)

This should give you output as 0.66

Code:

Output:

Im getting this now. Everything has a variable type of double. we have been playing with it but not getting anywhere. any suggitions?

@Waterfowl_Waterfowl_hunte,
Try this one

Math.Round(CDbl(Convert.ToDouble(Currentrow("cost"))/Convert.ToDouble(Currentrow("quantity"))),2)