Skip to content

Commit

Permalink
Fix/chart precision (#928)
Browse files Browse the repository at this point in the history
* fix precision while loop

* improve precision calc
  • Loading branch information
Nikita-Polyakov authored Jan 26, 2023
1 parent 6f42524 commit 3a8d80b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/Swap/Chart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,10 @@ const getPrecision = (value: number): number => {
if (value === 0 || !Number.isFinite(value)) return precision;
while (Math.floor(value) <= 0) {
value = value * 10;
let abs = Math.abs(value);
while (Math.floor(abs) <= 0) {
abs = abs * 10;
precision++;
}
Expand Down

0 comments on commit 3a8d80b

Please sign in to comment.