octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #8548] New integerizing range algorithm fo


From: Dan Sebald
Subject: [Octave-patch-tracker] [patch #8548] New integerizing range algorithm for non-integer elements using better interp.
Date: Wed, 01 Oct 2014 22:56:20 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 SeaMonkey/2.15

Follow-up Comment #2, patch #8548 (project octave):

Also, if one feels the tolerance of a single float discrepancy is too small,
this can be addressed by calling nextafter() multiple times:


float_is_int (double x)
{
  double absx = fabs (x);
  double roundabsx = gnulib::round (absx);
  double na = nextafter (absx, roundabsx);
  if (na == roundabsx)
    return true;
  else
    {
      na = nextafter (na, roundabsx);
      if (na == roundabsx)
        return true;
      else if (nextafter (na, roundabsx) == roundabsx)
        return true;
    }
  return false;
}


However, I'm inclinded to assume the tolerance of one floating point number
away is adequate until shown otherwise.  A test script with a good test should
indicate if that isn't adequate on some developer's computer.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8548>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]