Skip to content

Commit

Permalink
[regression/store] Avoid conversion from double to float
Browse files Browse the repository at this point in the history
The value of variable meanX was computed in double, but then stored in
another variable x of type float, thus causing a conversion with
potentially a change of value, and then some incorrect comparisons.
  • Loading branch information
GabrielNumworks authored and HugoNumworks committed Jun 17, 2021
1 parent 2702b77 commit 8cfa1d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/regression/store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ int Store::closestVerticalDot(int direction, double x, double y, int currentSeri
}

int Store::nextDot(int series, int direction, int dot) {
float nextX = INFINITY;
double nextX = INFINITY;
int selectedDot = -1;
double meanX = meanOfColumn(series, 0);
float x = meanX;
double x = meanX;
if (dot >= 0 && dot < numberOfPairsOfSeries(series)) {
x = get(series, 0, dot);
}
Expand Down

0 comments on commit 8cfa1d7

Please sign in to comment.