0

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);
    }
2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Salem
0

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?

0

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.