IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39994


Ignore:
Timestamp:
Mar 4, 2017, 4:35:17 PM (9 years ago)
Author:
eugene
Message:

avoid accidental overflow due to rounding

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relastro/src/bcatalog.c

    r39926 r39994  
    459459    if (isnan(X[i])) continue;
    460460    if (isnan(Y[i])) continue;
    461     ix = (X[i] - Xmin) / 200.0;
    462     iy = (Y[i] - Ymin) / 200.0;
     461    ix = MIN(0, MAX(NX - 1, (X[i] - Xmin) / 200.0));
     462    iy = MIN(0, MAX(NY - 1, (Y[i] - Ymin) / 200.0));
    463463    int Nn = Nn_grid[ix][iy];
    464464    Nm_grid[ix][iy][Nn] = subcatalog[0].average[i].Nmeasure;
     
    500500  }
    501501
    502   // cycle over the grid until we ready Nmax
     502  // cycle over the grid until we reach Nmax
    503503  off_t *keepidx = NULL;
    504504  ALLOCATE (keepidx, off_t, Naverage);
Note: See TracChangeset for help on using the changeset viewer.