Skip to content

Commit

Permalink
Prevented condition in precision that lead to infinate loops
Browse files Browse the repository at this point in the history
  • Loading branch information
lancegliser committed Sep 25, 2024
1 parent 98a562b commit f3decbe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/features/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export function precision(x: number): number {
let p = 0;
while (Math.round(x * e) / e !== x) {
e *= 10;
// Happened on several columns in the asteroid data set. moid for sure.
if (!isFinite(e)) {
return p;
}
p++;
}
return p;
Expand Down

0 comments on commit f3decbe

Please sign in to comment.