Quantcast
Channel: WinDev Forum
Viewing all articles
Browse latest Browse all 1914

[WD19] Calculation with rounding on 6 decimals

$
0
0
Hi all,

I was under the impression that using currencies for calculations was the way to use (max.) six decimal places, but that does not seem to be necessarily so. I get a result with only four decimal places instead of the expected 6 decimals.
Now I have used numerics as intermediate fields and found it to be correct calculation. What causes the difference in the calculation of currencies?

lcyKgPrijs = TblSlachtrapport.DEF_PrijsNoteringWeekprijs // 0.595
lcyBtwPerc = TblBtw.BTWPercentage // 6
lcyKgPrijsExcl = round(lcyKgPrijs / (100.0 + lcyBtwPerc) * 100.0, 6)
// lcyKgPrijsExcl is : 0.5613 --> 4 decimals, but should be 6 decimals

lnKgPrijs is numeric(5,7) = TblSlachtrapport.DEF_PrijsNoteringWeekprijs // 0.595
lnBtwPerc is numeric(5,7) = TblBtw.BTWPercentage // 6
lcyKgPrijsExcl = Round(lnKgPrijs / (100.0 + lnBtwPerc) * 100.0, 6)
// lcyKgPrijsExcl is : 0.561321 is OK

Thanks for any hints.

Viewing all articles
Browse latest Browse all 1914

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>