On Nov 16, 6:08 am, "emre esirik(hacettepe computer science and
engineering)" <emreesi...@gmail.comwrote:
/////////////////////// DIVISION FUNCTION ////////////////////
void div ( int pol1[] , int pol1p[] , int pol2[] , int pol2p[])
{
int r=0,z,i,g,j,k,l,dividend[6],rising[6]={0};
for (i=0 ; i<6 ; i++)
dividend[i]=pol1[i];
for(i=5 ; i >=0 ; i--)
{
if(dividend[i]!=0)
{
for(z=5 ; z>=0 ; z--)
{
if(pol2[z]!=0)
{
*(po5 + (i-z))= dividend[i]/pol2[z];
r++;
for(l=0; l<6; l++)
rising[l]=0;
for (j=z ; j>=0 ; j--) {
rising[i+j-z] += (*(po5 + i-z) * pol2[j]);
}
for(k=0; k<6 ; k++) {
dividend[k] = dividend[k] - rising[k];
}
}
}
}
}
this is my code, its for 2 poly which max power is 5 and I have to
divide them but it sometimes divide right,sometimes divide wrong,
can you see the problem?
C:\tmp>splint div.c
Splint 3.1.1 --- 12 Mar 2007
div.c(1,17): Function div inconsistently declared to return void
A function, variable or constant is redefined with a different type.
(Use
-incondefs to inhibit warning)
load file standard.lcd: Specification of div: div_t
div.c(1,17): Function div declared with 4 args, specified with 2
Types are incompatible. (Use -type to inhibit warning)
load file standard.lcd: Specification of div
div.c(1,25): Parameter 1, pol1, of function div has inconsistent type:
declared int [], specified int
load file standard.lcd: Specification of pol1: int
div.c(1,37): Parameter 2, pol1p, of function div has inconsistent
type:
declared int [], specified int
load file standard.lcd: Specification of pol1p: int
div.c: (in function div)
div.c(12,5): Initializer block for rising has 1 element, but declared
as int
[6]: 0
Initializer does not define all elements of a declared array. (Use
-initallelements to inhibit warning)
div.c(20,23): Unrecognized identifier: po5
Identifier used in code has not been declared. (Use -unrecog to
inhibit
warning)
div.c(6,21): Variable g declared but not used
A variable is declared but never used. Use /*@unused@*/ in front of
declaration to suppress message. (Use -varuse to inhibit warning)
div.c(1,37): Parameter pol1p not used
A function parameter is not used in the body of the function. If the
argument
is needed for type compatibility or future plans, use /*@unused@*/
in the
argument declaration. (Use -paramuse to inhibit warning)
div.c(1,62): Parameter pol2p not used
Finished checking --- 9 code warnings