-
Notifications
You must be signed in to change notification settings - Fork 54
1268/4 decimals for amounts everywhere #1281
Conversation
|
@elena-zh Ok I was unsure as this was in the description :)
|
I can't test no 3 when using Chrome as I currently can't place an order...If I change to production or Brave it works . Bildschirmaufnahme.2021-08-19.um.13.23.21.mov |
In addition to @MareenG comments, I'd like to add some calculation and rounding issues: |
If you insert manually an amount into the FROM field with more than 4 decimals it is displayed with 3 decimals in the confirmation modal Bildschirmaufnahme.2021-08-19.um.14.53.22.movSometimes it is even displayed with less decimals e.g. for cases such as if you type in 1.0000007 it is displayed as 1 |
ooof @alfetopito I don't envy you in this PR with the amount of comments you got 😂 |
Lot's of great points!
I though you had something to add instead of continuing with the bullying =P |
nope just bullying 😅 😂 |
Couldn't reproduce either. |
I could swear I fixed this, but you prove me wrong. I'll keep as is until #999 is addressed though, to not make this PR more complex. |
I've just changed that to round the opposite* input to 4 decimals to fix this issue (#1281 (comment)), but the current input can have as many decimals as you need. Anyway, the point is: If you are typing, go wild. The input is not capped. *By opposite I mean, if you type on |
Should be covered by the same fix as #1281 (comment) |
This one took me a looong time to figure out. The explanation is simple: The lib that does the "smart" formatting does this to better format big numbers and makes some assumptions. |
That's the expected behaviour. |
As I explained in #1281 (comment), this is happening because of rounding. 10.000008 with 4 decimals of precision rounds to 10.0000, removing the zeros => 10. As for the USD estimation, hmm. That should not impact it because the estimations should be based on the full amount. |
Yes, I see how that could be a problem. What about rounding down, then? @gnosis/gp-frontend any opinion on this one? |
9bb39cd
to
b954fb6
Compare
@alfetopito Just for reference, this is what the Safe has been using I think https://github.com/gnosis/safe/blob/a87d5d8af99a4d6fd35424a7e0743379a44bf9a8/archive/specs/common/format_amounts.rst |
Sorry but I didn't understand the command. Please consult the commands documentation 📚. Hey, I reacted but my real name is @Mergifyio |
Hey @alfetopito , it might be another edge case, but it would be nice to remove a period in the end of a number when a decimal part is rounded to 0 However, based on the lib info, here we should show 1 decimal number |
Sorry but I didn't understand the command. Please consult the commands documentation 📚. Hey, I reacted but my real name is @Mergifyio |
Yes, David based
Yes, that is an issue with the lib. I'll address that in another PR as this requires changes to the format lib like on #999 |
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.
Other than the trailing dot, that I also manage to reproduce, but only briefly, probably was because by chance the price ended on zero or something.
Good to merge since that issue was moved to be solved in other PR.
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.
I retested the rp and reported remaining low prio issues in separate tasks.
b954fb6
to
cf3fc71
Compare
Summary
Closes #1268
Makes all displayed amounts up to at most 4 decimals of precision.
Any amount bellow that will show
< 0.0001
.USD estimations and percentages remain at 2 decimals.
Prices remain at 6 decimals.
To Test