fix: added marusicbostjan as blog post author

This commit is contained in:
Jan Halfar 2023-03-10 10:51:30 +01:00 committed by GitHub
parent c1c589e200
commit 2b2bf60502
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.