I'm trying to learn a bit about floating point operations in NASM Assembly for 32-bit programs in Ubuntu.
I'm interested in getting a number's square root. This is what I tried:
SECTION .data
num: dd 100
var: dd 0
SECTION .text
global main
main:
fld dword [num]
fsqrt
fstp dword [var]
mov EAX,[var]
I was expecting EAX
to be 10. But GDB says that it is 0x1be24630
(467813936
), which by the way I'm not sure how to convert to something more readable - but I think that if the result was 10, it would actually show up as 10, no?
What am I doing wrong here? Or is 0x1be24630
actually 10?