 # Average formula gives wrong result

My table has 15 columns with percentages, in 16 columns, I want to get the average percent. The formula is: Average(list of columns)
One row has 90% in one column and 0% in the rest. Result should be 90/15=6%
But the formula gives me 6.0000000000000005%

Dear @Nurlan_A

Kindly consider to use round() in the formula to control the digits behind the dot and to get the expected result.

Dear @Nurlan_A,

As @Jean_Pierre_Traets suggests, you can either rounding your formula or limit the decimals in the column settings.

3 Likes

@Jean_Pierre_Traets & @Federico.Stefanato thank you for your help, I limited the decimals.

But I still think that this is wrong, that in such simple calculations, an ordinary user has to deal with rounding and the IEEE standard. This should be improved!

I agree, Excel and Google Sheets handle this better. They default to display precision of 2 decimal places, but even when expanded they have better accuracy. Not sure the reason, maybe more precision in the floating point calculations.

In Golang, `19.0/15.0` (`float64`) also gives `6.0` correctly. Not sure why the difference between Coda as Golang appears to use 64 bit floating point and I assume coda does as well. However in Go `0.3 + 0.9` shows precision error (`0.8999...`).

https://play.golang.org/p/HgGO-ZypjZu

1 Like