J’ai toujours la même sortie sur mon ordi (gcc 4.7) mais sur un autre ordi (gcc 4.6) j’ai effectivement des valeurs qui changent.
Soit c’est un problème d’arrondi (ça me paraît bizzare) soit c’est un problème de valeur non initialisée (ça me paraît bizzare aussi) soit … ?
Tu peux toujours regarder le code assembleur:
gcc 4.7
$ gdb -q a.out
Reading symbols from /media/Unstable/a.out...done.
(gdb) disas main
Dump of assembler code for function main:
0x000000000040050c <+0>: push %rbp
0x000000000040050d <+1>: mov %rsp,%rbp
0x0000000000400510 <+4>: sub $0x10,%rsp
0x0000000000400514 <+8>: movabs $0x40314ccccccccccd,%rdx
0x000000000040051e <+18>: movabs $0x405edccccccccccd,%rax
0x0000000000400528 <+28>: mov %rdx,-0x8(%rbp)
0x000000000040052c <+32>: movsd -0x8(%rbp),%xmm1
0x0000000000400531 <+37>: mov $0x9,%esi
0x0000000000400536 <+42>: mov %rax,-0x8(%rbp)
0x000000000040053a <+46>: movsd -0x8(%rbp),%xmm0
0x000000000040053f <+51>: mov $0x40060c,%edi
0x0000000000400544 <+56>: mov $0x2,%eax
0x0000000000400549 <+61>: callq 0x4003e0 <printf@plt>
0x000000000040054e <+66>: mov $0x0,%eax
0x0000000000400553 <+71>: leaveq
0x0000000000400554 <+72>: retq
End of assembler dump.
gcc 4.6
$ gdb -q a.out
Reading symbols from /home/eo/a.out...done.
(gdb) disas
No frame selected.
(gdb) disas main
Dump of assembler code for function main:
0x00000000004004e4 <+0>: push %rbp
0x00000000004004e5 <+1>: mov %rsp,%rbp
0x00000000004004e8 <+4>: mov $0x400610,%eax
0x00000000004004ed <+9>: movsd 0x12b(%rip),%xmm1 # 0x400620
0x00000000004004f5 <+17>: movsd 0x12b(%rip),%xmm0 # 0x400628
0x00000000004004fd <+25>: mov $0x9,%esi
0x0000000000400502 <+30>: mov %rax,%rdi
0x0000000000400505 <+33>: mov $0x2,%eax
0x000000000040050a <+38>: callq 0x4003e0 <printf@plt>
0x000000000040050f <+43>: mov $0x0,%eax
0x0000000000400514 <+48>: pop %rbp
0x0000000000400515 <+49>: retq
End of assembler dump.
PS: si tu veux une erreur
$ gcc main.c -Wall -Wextra -pedantic -Werror
main.c: In function ‘main’:
main.c:6:5: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘double’ [-Werror=format]
cc1: all warnings being treated as errors