Skip to content

Commit

Permalink
ticks.cpp: fix bug NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKepzie committed Dec 22, 2014
1 parent e89b923 commit 587bb69
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Gui/ticks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ ticks_bounds(double xmin,
const int h = half_tick ? 2 : 1;
const int mult = h * tick_width * tick_max;
// make sure offset is outside of the range (xmin,xmax)
*offset = mult * ( (xmin > 0) ? std::floor(xmin / mult) : std::ceil(xmax / mult) );
if (mult != 0) {
*offset = mult * ( (xmin > 0) ? std::floor(xmin / mult) : std::ceil(xmax / mult) );
} else {
*offset = 0;
}
}
*m1 = std::ceil( (xmin - *offset) / tick_width );
*m2 = std::floor( (xmax - *offset) / tick_width );
Expand Down

0 comments on commit 587bb69

Please sign in to comment.