IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38151


Ignore:
Timestamp:
Apr 18, 2015, 6:21:14 AM (11 years ago)
Author:
eugene
Message:

correctly handle inf / nan in limits

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150405/Ohana/src/opihi/lib.data/graphtools.c

    r31160 r38151  
    1010  if (xvec != NULL) {
    1111    if (xvec->type == OPIHI_FLT) {
    12       maxX = minX = xvec[0].elements.Flt[0];
    13       for (i = 1; i < xvec[0].Nelements; i++) {
     12      maxX = DBL_MIN;
     13      minX = DBL_MAX;
     14      for (i = 0; i < xvec[0].Nelements; i++) {
    1415        if (!finite(xvec[0].elements.Flt[i])) continue;
    1516        maxX = MAX (maxX, xvec[0].elements.Flt[i]);
     
    1920      maxX = minX = xvec[0].elements.Int[0];
    2021      for (i = 1; i < xvec[0].Nelements; i++) {
    21         if (!finite(xvec[0].elements.Int[i])) continue;
    2222        maxX = MAX (maxX, xvec[0].elements.Int[i]);
    2323        minX = MIN (minX, xvec[0].elements.Int[i]);
     
    3333  if (yvec != NULL) {
    3434    if (yvec->type == OPIHI_FLT) {
    35       maxY = minY = yvec[0].elements.Flt[0];
    36       for (i = 1; i < yvec[0].Nelements; i++) {
     35      maxY = DBL_MIN;
     36      minY = DBL_MAX;
     37      for (i = 0; i < yvec[0].Nelements; i++) {
    3738        if (!finite(yvec[0].elements.Flt[i])) continue;
    3839        maxY = MAX (maxY, yvec[0].elements.Flt[i]);
     
    4243      maxY = minY = yvec[0].elements.Int[0];
    4344      for (i = 1; i < yvec[0].Nelements; i++) {
    44         if (!finite(yvec[0].elements.Int[i])) continue;
    4545        maxY = MAX (maxY, yvec[0].elements.Int[i]);
    4646        minY = MIN (minY, yvec[0].elements.Int[i]);
Note: See TracChangeset for help on using the changeset viewer.