|
|
вернуться в форумinline assembly Послано zfoolj 8 авг 2009 08:00 Can anybody tell me where is wrong ? I have tested it with random real numbers and it worked fine. I don't know much about FPU. #include "stdio.h" char sIn[] = "%lf"; char sOut[] = "%.4lf\n"; double d[150000]; int main(){ __asm{ push ebx mov ebx, 0h sub ebx, 8h A1: add ebx, 8h lea eax, d[ebx] push eax mov eax, offset sIn push eax call dword ptr scanf add esp, 8h cmp eax, EOF jne A1 fwait finit A2: sub ebx, 8h cmp ebx, 0h jl A3 sub esp, 8h lea eax, d[ebx] fld qword ptr [eax] fsqrt fstp qword ptr [esp] mov eax, offset sOut push eax call dword ptr printf add esp, 0ch jmp A2 A3: pop ebx } return 0; } |
|
|