Skip to content

Commit

Permalink
Per #2644, additional range checking to handle bad input values of t.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed Aug 14, 2023
1 parent 61d4121 commit fb2a0dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/basic/vx_math/ptile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if ( n > 0 ) {
p = ordered_array[index];
}
// Interpolate linearly between two values
else {
else if ( index >= 0 && index < (n - 1) ) {
delta = (n - 1)*t - index;
p = (1 - delta)*ordered_array[index] + delta*ordered_array[index + 1];
}
Expand Down Expand Up @@ -119,7 +119,7 @@ if ( n > 0 ) {
p = ordered_array[index];
}
// Interpolate linearly between two values
else {
else if ( index >= 0 && index < (n - 1) ) {
delta = (n - 1)*t - index;
p = (1 - delta)*ordered_array[index] + delta*ordered_array[index + 1];
}
Expand Down

0 comments on commit fb2a0dc

Please sign in to comment.