assembly - Nasm floating point reading and printing error -


this code wrote reading 2 floating point numbers , stored in memory. load memory , print it. however, i'm getting wrong value first number when printing it. i'm getting correct value second number. dont know going wrong in code. please help.

section .data message1: db "enter first number: ", 0 message2: db "enter second number: ", 0 formatin: db "%lf", 0 formatout: db "%lf", 10, 0 ; newline, nul terminator  section .bss f1: resd 1 f2: resd 1  section .text global main  extern scanf  extern printf       main:   push message1 call printf  add esp, 4  push f1 push formatin  call scanf add esp, 8   push message2 call printf add esp, 4   push f2 push formatin call scanf add esp, 8  fld qword[f1] sub esp, 4 fst qword[esp] push formatout call printf add esp, 8  fld qword[f2] sub esp, 4 fst qword[esp] push formatout call printf add esp, 8   mov eax,1 mov ebx,0 int 80h 

try use resq instead of resd

f1: resq 1 f2: resq 1 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -