title: How to divide floating-point number in x86 assembly?
body: <p>When i try to write Heron  algorithm to count sqrt from ECX register, it doesn't work. It looks like the problem is dividing floating numbers, because the result is integer.</p>
  
  <p>My algorithm: </p>
  
  <blockquote>
  <pre><code> sqrtecx:
  </code></pre>
  </blockquote>
  
  <pre><code>MOV EDX, 10 ; loop count
  MOV EAX, 5 ; x_0 in heron algorythm
  MOV DWORD[EBP-100], ECX  ; save INPUT (ecx is input)    
  MOV DWORD[EBP-104], EDX  ; save loop count
  jmp     loop
  MOV     ECX, EAX ; move  OUTPUT to ECX
  
  loop:
  
  MOV DWORD[EBP-104], EDX ; save loop count
  xor edx, edx
  
  MOV ECX, EAX
  MOV     EAX, DWORD[EBP-100]
  DIV ECX
  ADD EAX, ECX
  XOR EDX, EDX
  mov ecx, 2
  DIV ecx
  
  MOV EDX, DWORD[EBP-104] ; load loop count
  DEC EDX
  JNZ loop
  </code></pre>