Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Im creating a solve quadratic formula HLA program but im having issues finding the error program solveQuadratic; #include ( stdlib.hhf ) ; static a:
Im creating a solve quadratic formula HLA program but im having issues finding the error
program solveQuadratic;
#include "stdlib.hhf;
static
a: real;
b: real;
c: real;
discriminant: real;
root: real;
root: real;
begin solveQuadratic;
Prompt and read values for a b and c
stdout.putGimme a value for a: ;
stdin.geta;
stdout.putGimme a value for b: ;
stdin.getb;
stdout.putGimme a value for c: ;
stdin.getc;
Calculate the discriminant
movb eax;
fldeax;
fmulst st; b
flda;
fldc;
fmulst st; a c
faddst st; ac
fsub; bac
fstpdiscriminant;
Compute the roots
flddiscriminant;
fsqrt;
fstproot; store sqrtdiscriminant in root
Calculate the positive root
fldb;
fchs; b
fldroot;
fadd; b sqrtdiscriminant
flda;
faddst st; a
fdiv; b sqrtdiscriminanta
fstproot;
Calculate the negative root
fldb;
fchs; b
fldroot;
fsub; b sqrtdiscriminant
flda;
faddst st; a
fdiv; b sqrtdiscriminanta
fstproot;
Output the roots
stdout.putx is root:: and x is also root::
;
end solveQuadratic;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started