From 2b2bf6050211c30a9d287c3e8de3451cb231ffe8 Mon Sep 17 00:00:00 2001 From: Jan Halfar Date: Fri, 10 Mar 2023 10:51:30 +0100 Subject: [PATCH] fix: added marusicbostjan as blog post author --- .../2023-03-06-accuracy-of-decimal-computations/index.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/foomo/blog/2023-03-06-accuracy-of-decimal-computations/index.mdx b/foomo/blog/2023-03-06-accuracy-of-decimal-computations/index.mdx index 3f763c9..128699d 100644 --- a/foomo/blog/2023-03-06-accuracy-of-decimal-computations/index.mdx +++ b/foomo/blog/2023-03-06-accuracy-of-decimal-computations/index.mdx @@ -1,6 +1,6 @@ --- slug: accuracy-of-decimal-computations -authors: [patrickb] +authors: [patrickb, marusicbostjan] tags: [golang, currency, decimal accuracy] --- @@ -66,7 +66,7 @@ Use Int by representing money in cents: ## Conclusion -Division is a problem! +**Division is a problem!** 1/3 - > 0.33333333… Correct way: 0.33, 0.33, 0.34 @@ -74,4 +74,4 @@ Correct way: 0.33, 0.33, 0.34 When doing money calculations one should avoid division as it inevitably leads to loss of accuracy. When dividing make sure to round to cent and deal with diffs. -Division by 10^k is ok till we are inside of the range of the data type. +Division by 10^k is ok as long as we are inside of the range of the data type.