Jump to content

warning:internal error

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
skb_mys

skb_mys

    Newbie

  • Members
  • Pip
  • 1 posts
hi.I am getting a few warnings when i built a program written in c and assembly in avr studio.I have given below a portion of program.please help


#define num_dic 5

#define size_dic 40

int main(void)

{

   unsigned char ii;//[0-256]

   int jj,kk=0;

   unsigned char result,temp;

   float  differ[num_dic];

   int  tmp_array[size_dic];

   float diffeuclid[num_dic];

   unsigned char rangeindex[num_dic];   // store the code with large coefficients

   

   for (ii=0;ii<num_dic;ii++)

   {

     differ[ii]=0.0;      

     diffeuclid[ii]=0.0;

   }

   

   for( ii=0; ii < num_dic; ii++ ) 

   {                             

      for(jj=0;jj<size_dic;jj++)

      {

          tmp_array[jj]=dic[ii][jj];

      }

      differ[ii]=calcorrelation(tmp_array, word);

      

   }                

       

           

   for(ii=0; ii<num_dic;ii++)

   {

       if(differ[ii]<0.01)  /*warning:internal error-out of range error*/

       { 

        rangeindex[kk++]=ii;

       } 

   }                            

}            

      


float calcorrelation(int a[size_dic], int b[size_dic])

{ 

    int ii;

    float meanx1=0, meanx2=0, meanxy=0, meany1=0, meany2=0;

    float r;

    for (ii=0; ii<size_dic; ii++)

    {

        meanx1 = meanx1 + fix2float(a[ii]);    /*warning:internal error-out of range error*/


        meanx2 = meanx2 + fix2float(a[ii])*fix2float(a[ii]);   /*warning:internal error-out of range error*/


        meany1 = meany1 + fix2float(b[ii]);   /*warning:internal error-out of range error*/


        meany2 = meany2 + fix2float(b[ii])*fix2float(b[ii]);   /*warning:internal error-out of range error*/


        meanxy = meanxy + fix2float(a[ii])*fix2float(b[ii]);  /*warning:internal error-out of range error*/


    }

    

    if (((size_dic*meanx2-meanx1*meanx1)==0) && ((size_dic*meany2-meany1*meany1)==0) )  /*warning:internal error-out of range error*/


       r = 0;

    else 

    {    

       r=(size_dic*meanxy-meanx1*meany1)*(size_dic*meanxy-meanx1*meany1)/(size_dic*meanx2-meanx1*meanx1)/(size_dic*meany2-meany1*meany1)   /*warning:internal error-out of range error*/

;

       r=1-r;

    }     

      

    if (r < 0)   /*warning:internal error-out of range error*/


    {

         r = -r;

    }

    return r;

}



#2
Mathematix

Mathematix

    Programmer

  • Members
  • PipPipPipPip
  • 112 posts
Have you debugged your code to check that the values are in range?

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
A warning is not necessarily an error. It seems odd that you're using char instead of int for your indices, though.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog