Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix precision issues while formatting amounts #20994

Closed
onyb opened this issue Feb 9, 2022 · 1 comment · Fixed by brave/brave-core#12224
Closed

Fix precision issues while formatting amounts #20994

onyb opened this issue Feb 9, 2022 · 1 comment · Fixed by brave/brave-core#12224

Comments

@onyb
Copy link
Member

onyb commented Feb 9, 2022

User report: https://twitter.com/jim74255/status/1491103364746452994

We have no consistent way of formatting balances/amounts with rounding. Here are two most common issues we're facing with amount values:

  1. very small amounts are rounded incorrectly, resulting in loss of precision.
    For example, 0.000318182 ETH will be formatted as 0.0001 ETH.
  2. some amount values should never be rounded, notably anything that user will refer to before signing a transaction.
    For example, values seen in the transaction confirmation screen.
    During an internal brainstorming, we considered not rounding amounts at all, but this will result in poor UX. This issue is about bringing contextual precision to amounts by introducing better formatting tools.
@Uni-verse
Copy link
Contributor

Uni-verse commented Mar 29, 2022

Verification Completed using:

Brave | 1.37.105 Chromium: 100.0.4896.46 (Official Build) (x86_64)
-- | --
Revision | 5ca33821b2211805855c77d334353d27c616a7ca-refs/branch-heads/4896@{#584}
OS | macOS Version 12.1 (Build 21C52)
  • 6 significant figures for asset amounts
  • 3 decimal places for fiat > 1 && < 10
  • 1 demical places for fiat amounts > 10
  • Small amounts are precise
  • No unnecessary decimals for asset amounts
Txn Fee Assets 1 < n < 10 Unnecessary decimals precision swap moda precision
Screen Shot 2022-03-28 at 9 49 24 PM Screen Shot 2022-03-28 at 9 49 41 PM Screen Shot 2022-03-28 at 9 50 26 PM Screen Shot 2022-03-28 at 9 51 40 PM Screen Shot 2022-03-28 at 9 52 59 PM Screen Shot 2022-03-28 at 9 53 39 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants