Bonsoir,
je veux ecrire un code qui sert a faire le codage d'un nombre float ( norme IEE754) , j'ai ecris un code mais mon probleme ( 127+exposant en binaire sa s'affiche inversé et j'ai pas arrivé a l'affecté au tableau comme il le faut)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
int c=0,cn=0,d=0;
void Binary(int nbr,int *rest,int indic){
c=0;
if (indic==1)
    c=1;
        do
    {
        rest[c]=abs(nbr)%2;
        nbr/=2;
        c++;
    }while(nbr!=0);
}
int main()
{
   float monFloat=-13.99,partfloat;
    int  temp,k=0,j,manti=0,partEntiere,i,precision=2,rest[100]={0},*code=calloc(100,sizeof(int)),*test=calloc(100,sizeof(int));
manti=c+1 ;
puts("");
Binary(c-1+127,code,1);
if(monFloat<0)
    code[0]=1;
for(i=0,j=c;i<manti;i++)
{
    code[j]=rest[i];
    j++;
}
for(i=0;i<32;i++)
printf("%d",code[i]);
puts("");
}
merci de m'aider car apres affecté partie des 8 bit je vais faire des conditions pour 64 bit et aussi le transformer en hexa veuillez m'aider et merci infiniment.