Comments (4)
It's been a while since I worked on this but I think everything is rounded to the nearest 100th. I'm aware of floating point precision and its faults, however this is a javascript module that uses mongo, neither of which have support for fixed-point numbers like MySQL's decimal, so the point is moot.
from medici.
There is literally one place where is could happen - when we calculate total of all transactions. In the new [email protected]
the place is guarded by a brave if
statement.
Good news is that medici
is battle tested (by us). So, pretty sure precision is not an issue as of now.
from medici.
Thank you for maintaining this lib. I am currently evaluating for production use.
I found the following rounding issue:
{ "_id": "5a991a9446fa7c0794a507ab", "accounts": "Income", "credit": 99.8, "debit": 0, "book": "test", "memo": "Something else", "_journal": "5a991a9446fa7c0794a507a9", "datetime": "2018-03-02T09:34:12.100Z", "__v": 0, "approved": true, "voided": false, "timestamp": "2018-03-02T09:34:12.100Z", "account_path": [ "Income" ] }
{ "_id": "5a991a9446fa7c0794a507aa", "accounts": "Assets:Cash", "credit": 0, "debit": 99.9, "_journal": "5a991a9446fa7c0794a507a9", "book": "test", "memo": "Something else", "datetime": "2018-03-02T09:34:12.100Z", "__v": 0, "approved": true, "voided": false, "timestamp": "2018-03-02T09:34:12.100Z", "account_path": [ "Assets", "Cash" ] }
When I try to debit "0" and credit "0.1" then I get the expected error:
Journal is invalid. Total is: 0.01
(node:1940) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: INVALID_JOURNAL
Any thoughts on this? And thanks in advance.
Harald
from medici.
Would you be able to:
- extract the code snippet which reproduces the bug?
- and create a new issue for the bug.
That would help us significantly.
Thanks!
from medici.
Related Issues (20)
- Mongoose Specify Connection HOT 4
- Set Timestamp for Journal Entry HOT 7
- Question: do you have an UI for this or do you plan to build one? HOT 3
- last version not released? HOT 3
- new release HOT 3
- Questions on the implementation HOT 10
- Question: Why MongoDB? Have you considered iterating to a relational db? HOT 1
- How we can update custom field after entry is done HOT 3
- demo or sample
- Failing to get started HOT 2
- Mongoose connection string HOT 1
- Missing changelog for 6.0.0 HOT 2
- Value Added Tax HOT 4
- Question: Future Posting Date HOT 5
- start_date and end_date filter on balance API doesn't work correctly if an exisiting balance snapshot is present HOT 1
- Getting Error in Local Dev Server HOT 5
- Intent to ship v7.0 HOT 4
- How to add a Opening Balance to a Book HOT 1
- How to find balance for a previous date ? HOT 1
- Can we know if Debit balance is intentionally given as "negative" value ? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from medici.