mirror of
https://github.com/foomo/foomo-docs.git
synced 2025-10-16 12:35:40 +00:00
fix: added marusicbostjan as blog post author
This commit is contained in:
parent
c1c589e200
commit
2b2bf60502
@ -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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user