-
Notifications
You must be signed in to change notification settings - Fork 8
fix: fix surplus calculation for very big numbers #515
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Pull Request Test Coverage Report for Build 5220880806
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2a5d317
to
2940230
Compare
@alfetopito sorry, it was an attempt to use Anxo's suggestion. Now it works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM.
Still, we have an issue with a surplus percentage, but it is reported in #462 and can be addressed later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, looks great now!
One gentle reminder that you should do that for the buySurplus as well
2940230
to
dbd5a7e
Compare
Summary
For some reason, the surplus is wrongly displayed for very big numbers.
Example: https://explorer.cow.fi/orders/0xe05b6a805656fdf2a4c404be0756f360e0297c53d00371da637a44e133676d2e6cd22a1d90eeba4bfd0080ad9f121d4a33b1fda96459d692?tab=overview
Background
bignumber.js
wrongly round very small numbers - when you divide something small to something very bigActual result:
Expected result:
To test
The displayed surplus should look the same for any other values: