title: printf float in nasm assembly 64-bit
body: <p>I want to print a float value with printf</p>
  
  <pre><code>global main
  extern printf
  
  section .data
     string: db `%f\n`, 0
  
  section .bss
     rs: resq 1
  
  [...]
  
     movq xmm0, [rs]
     mov rdi, string
     mov rax, 0
     call printf
  </code></pre>
  
  <p>rs contains the floating value 1.6</p>
  
  <pre><code>(gdb) x/fg &amp;rs
  0x600ad8 &lt;rs&gt;:  1.6000000000000001
  </code></pre>
  
  <p>but the program prints</p>
  
  <pre><code>[username@localhost folder]$ ./programname
  0.000000
  </code></pre>
  
  <p>who can I get the program to print 1.6? what am I doing wrong?</p>