seria harmonicznych z zespołem x86-64
Próbuję obliczyć serię harmonicznych.
W tej chwili wprowadzam numer, do którego chcę dodać dodatek.
Kiedy wprowadzam małą liczbę, taką jak 1.2, program po prostu zatrzymuje się, nie ulega awarii, wydaje się, że wykonuje obliczenia.
BUt to nigdy nie kończy programu
oto mój kod
<code>denominator: xor r14,r14 ;zero out r14 register add r14, 2 ;start counter at 2 fld1 ;load 1 into st0 fxch st2 denomLoop: fld1 mov [divisor], r14 ;put 1 into st0 fidiv dword [divisor] ;divide st0 by r14 inc r14 ;increment r14 fst qword [currentSum] ;pop current sum value into currentSum jmp addParts addParts: fld qword [currentSum] fadd st2 ;add result of first division to 1 fxch st2 ;place result of addition into st2 fld qword [realNumber] ;place real number into st0 ;compare to see if greater than inputed value fcom st2 ;compare st0 with st2 fstsw ax ;needed to do floating point comparisons on FPU sahf ;needed to do floating point comaprisons on FPU jg done ;jump if greater than jmp denomLoop ;jump if less than </code>
Kod w zasadzie oblicza 1/2 lub 1/3 lub 1/4 i dodaje go do sumy bieżącej, a następnie porównuje, aby zobaczyć, czy osiągnąłem wartość powyżej tego, co wprowadziłem, gdy już ma wartość, powinien wyjść z pętli
czy widzicie mój błąd?