Skip to content

dbeaver/pro#8687 fix(formatNumber): fix unit selection for floats and…#4276

Open
SychevAndrey wants to merge 3 commits intodevelfrom
8687-cb-sql-execution-diagram-improvements
Open

dbeaver/pro#8687 fix(formatNumber): fix unit selection for floats and…#4276
SychevAndrey wants to merge 3 commits intodevelfrom
8687-cb-sql-execution-diagram-improvements

Conversation

@SychevAndrey
Copy link
Copy Markdown
Contributor

… 6-digit numbers; use precision param below 1000

  • Use Math.log10 instead of toString().length to count integer digits — toString() on a float like 4036.29 has length 7, which incorrectly bucketed thousands-range values into millions
  • Fix exponent formula for 3n-digit numbers (e.g. 100000 gave exponent=6→M instead of 3→k)
  • Apply precision param d below 1000 (was hardcoded 2); default to 2
  • Add formatNumber.test.ts

… 6-digit numbers; use precision param below 1000

- Use Math.log10 instead of toString().length to count integer digits — toString() on a float
  like 4036.29 has length 7, which incorrectly bucketed thousands-range values into millions
- Fix exponent formula for 3n-digit numbers (e.g. 100000 gave exponent=6→M instead of 3→k)
- Apply precision param d below 1000 (was hardcoded 2); default to 2
- Add formatNumber.test.ts
@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 9, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 20 complexity

Metric Results
Complexity 20

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants