Valeur incoherent pour un double pourtant intialise
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
double Computeloss(int K)
{
int i,j,N;
double q,r,a;
double mu,Ploss,S,lambda;
lambda=0.3;//+0.1*randgen();
printf("lambda=%ld ",lambda);
///autre code
}
int main()
{
int N,k,i;
N=100;
double ploss;
for(k=0;k<N;k++)
{
ploss=Computeloss(k);
if(ploss<0.001)
{
printf("%ld \n",ploss);
//printf("K is good K=%d and Ploss=%lf\n",k,ploss);
break;
}
}
} |
quand je visualise lambda j'obtiens :
lambda=858993459
pourquoi ?
J'ai pourtant bien initialise lambda=0.3
le %lf represente bien un double !
C'est tout a fait incomprehensible !!
Re: Valeur incoherent pour un double pourtant intialise
Citation:
Envoyé par Battosaiii
quand je visualise lambda j'obtiens :
lambda=858993459
pourquoi ?
Code incomplet
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Compiling: main.c
main.c:3: warning: no previous prototype for 'Computeloss'
main.c: In function `Computeloss':
main.c:8: error: implicit declaration of function `printf'
main.c:8: warning: nested extern declaration of `printf'
<internal>:0: warning: redundant redeclaration of 'printf'
main.c:8: warning: long int format, double arg (arg 2)
main.c:4: warning: unused variable `i'
main.c:4: warning: unused variable `j'
main.c:4: warning: unused variable `N'
main.c:5: warning: unused variable `q'
main.c:5: warning: unused variable `r'
main.c:5: warning: unused variable `a'
main.c:6: warning: unused variable `mu'
main.c:6: warning: unused variable `Ploss'
main.c:6: warning: unused variable `S'
main.c: In function `main_':
main.c:24: warning: nested extern declaration of `printf'
<internal>:0: warning: redundant redeclaration of 'printf'
main.c:24: warning: long int format, double arg (arg 2)
main.c:15: warning: unused variable `i'
Process terminated with status 1 (0 minutes, 0 seconds) |