https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109008

--- Comment #36 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Ok, checked the #c30 patch with printouts from #c33 added by hand before return
true;
at the end of each of +/- op?_range, that passed 300000 tests too.
Out of the 297936 lines in the pr109008.h headers (rest are probably lines with
nans),
#include <math.h>

#include "pr109008-4.c"

struct S { float (*fn) (float); float lb, ub; };
struct S arr[] = {
#include "pr109008-4-new.h"
};
struct S arr2[] = {
#include "pr109008-4-iter.h"
};

int
main ()
{
  int stats[10] = {};
  float plus_inf = __builtin_inf ();
  float minus_inf = -plus_inf;
  for (int i = 0; i < sizeof (arr) / sizeof (arr[0]); ++i)
    {
      if (arr[i].lb == arr2[i].lb && arr[i].ub == arr2[i].ub)
        {
          stats[0]++;
          continue;
        }
      if (arr[i].lb > arr2[i].lb || arr[i].ub < arr2[i].ub)
        {
          stats[1]++;
          continue;
        }
      float lb = nextafterf (arr2[i].lb, minus_inf);
      float ub = nextafterf (arr2[i].ub, plus_inf);
      if (arr[i].lb == lb && arr[i].ub == ub)
        {
          stats[2]++;
          continue;
        }
      __builtin_printf ("%p %a %a %a %a\n", arr[i].fn, arr[i].lb, arr2[i].lb,
arr2[i].ub, arr[i].ub);
    }
  __builtin_printf ("%d %d %d\n", stats[0], stats[1], stats[2]);
}

hack shows 128572 cases where both approaches yield the same ranges, 0 cases
where the #c32 would result
in narrower ranges than #c30, 167497 where both bounds are exactly one ulp
worse with #c32 and 1868
other cases, some are 2ulps, others a little bit more.  But I'd say this is
still all acceptable.

Richi, what do you think?

I'll bootstrap/regtest the #c32 patch overnight just in case.

Reply via email to