BF: Fix for overflow bug
The code:
float xmax, xmin;
xmax = x.Maximum();
xmin = x.Minimum();
for (int idx=1; idx<=xi.Nrows(); idx++) {
if(xi(idx) >= xmax) {
can fail due to double-> float conversion
e.g.
x.Maximum = 1.99999999
xmax = float(1.99999999) = 2.0
xi(idx) = 1.99999999 will fail xi(idx) >= xmax
, and result in an invalid element access later on in the loop.
Changing to xmax
,xmin
to match the underlying matrix storage type ( double) will fix this.
An example of this behaviour is in /vols/Data/fsldev/dataSets/regressionTests/2012.0/