to C guru.

i dont understand why this code fail
because of implicit declaration.
undefined reference to `__finite'

#define isfinite(x) \
     (sizeof (x) == sizeof (float)                              \
      ? __finitef (x)                                                 \
      : sizeof (x) == sizeof (double)                         \
      ? __finite (x) : __finitel (x))



  for (class_num = 0; class_num < classifier->settings->class_num;
       class_num++)
    {
      // maximum belief
      double x =
        classifier->belief[class_num] / ((double) classifier->sample_num);
      argmax = isfinite (x) && (x > max) ? class_num : argmax;
      max = isfinite (x) && (x > max) ? x : max;
      
      // mean beliefs
      classifier->mean_belief[class_num] +=
        (classifier->belief[class_num] / ((double) classifier->sample_num) -
         classifier->mean_belief[class_num]) /
        ((double) classifier->window_num);
    }

Is that something you copied out of a header file which came with your compiler?

Or did you find that macro on the net somewhere, and just copy/pasted it into your code?

Well that code is going to be specific to one particular OS/Compiler.

Which means if you're using something else, you need to do some work. You need to say what you're using to compile with to get any further.

This article has been dead for over six months. Start a new discussion instead.