Code seems to skip the while loop:
int i,j;
i= floor((Lx-23.61)/0.1);
j=0;
while(Nh - modSED[i][j] > 0.0){
j++;
}
if(j>0 && modSED[i][j]-Nh > Nh-modSED[i][j-1]){
fileNH=modSED[i][j-1];
}else{
fileNH=modSED[i][j];
}
It's more or less a crude linear search through an array of doubles (the i-index is preset by another part of the code and shouldn't be a problem). The code seems to misbehave when I look at GDB:
Breakpoint 1, mag (filter=4, Lx=23.930108812418158, z=0.57071772467724535, Nh=0.011911981460606383) at infopt.c:45
45 while(Nh-modSED[i][j]>0.0){
(gdb) print Nh-modSED[i][j]
$1 = 0.001911981460606383
(gdb) n
48 if(j>0 && modSED[i][j]-Nh > Nh-modSED[i][j-1]){
(gdb)
and it has just skipped the j++ segment, even though the while loop should evaluate to true.
Thanks, Josh