Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle committed Jan 1, 2019
1 parent 38dc932 commit 3f22d35
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/scales/scale.linearbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ function generateTicks(generationOptions, dataRange) {
factor = Math.pow(10, precision);
spacing = Math.ceil(spacing * factor) / factor;
}

// Loop here is for the case when min / spacing === max / spacing
// This happens due to float inccuracy when min and max are really close to each other
// One case: min = 1.8548483304974972 and max = 1.8548483304974974
do {
niceMin = Math.floor(dataRange.min / spacing) * spacing;
niceMax = Math.ceil(dataRange.max / spacing) * spacing;
Expand Down

0 comments on commit 3f22d35

Please sign in to comment.