hello, i'm trying to resolve an equation with 16 bits arithmetic, my program works perfectly when i use 32 bits
i don't understand why, even if i put 1 or 0 as a value, i have a wrong number. here is my equation: X³ -11X² +98X - 24
note: i use scanf to get the value from the user:
[...]
calculer:
mov ax, word[IntVal]; value from scanf
mov [temp], ax ; on store la variable entré par le user dans la variable temporaire
imul ax, ax
imul ax, [temp]
jo erreur
mov word[IntVal], ax ;on stock le résultat dans IntVal pour le preserver
xor ax, ax
mov ax, [temp] ;on y remet la valeur de départ pour les prochains calculs
imul ax, ax ;eax * eax => X²
imul ax, 11
jo erreur
sub word[IntVal], ax
xor ax, ax
mov ax, [temp] ;on remet la valeur temp dans le eax
imul ax, 98
jo erreur
add word[IntVal], ax
sub word[IntVal], byte 24; X³ -11x² + 98x - 24
jmp afficher
[...]
you'll find the file attached