I learned that the floating point error involves the arithmetic operation, but when I am stepping through the problems and checking all the registers everything is doing what it is suppose to do. I am trying to find the median from 1 to n. I go the first median printed, but then it results in a floating point error when going back into the loop.
SECTION .data
Median:
num: db "%d " , 10, 0
SECTION .bss
SECTION .text
extern printf
global main
main:
nop
push ebp
mov ebp, esp
push ebx
push esi
push edi
;boiler plate
;start of main code
;first loop to adding summation
xor edx, edx
xor eax, eax
xor esi, esi
xor ecx, ecx
xor edi, edi
xor ebx, ebx
xor ebp, ebp
L1: ;n-1 counter
mov ecx, 2
inc ebx ;start of n // counter
mov eax, ebx
sub eax, 1
mul ebx
div ecx
mov esi, eax ;value from here
mov ebp, ebx ;start of n+1 to add to see if equal
add ebp, 1 ;n+1
cmp ebp, esi
jne compare
compare: ;if n+1 does not equal to esi add next value to n+1
mov eax, ebp
add eax, 1
add ebp, eax
cmp ebp, esi
je print
jmp lessthan
lessthan:
cmp ebp, esi
jle compare
jge L1
print:
mov eax, ebx
push eax
push num
call printf
add esp, 8
mov edi, ebx
jmp L1
done:; finishes the loops/boilerplate after this
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret