# mips assembly -- 2

Description:

Write a complete program that prompts the user for the coefficients a, b, and c of a quadratic equation

ax2 + bx + c = 0 and outputs the solutions as shown. discriminant = b2

– 4ac

Use single precision floating point.

1. main() – prompt the user for a, b, and c, call solveqe to solve the equation, and display the results using the

return value from solveqe.

2. int solveqe(float a, float b, float c) – solve for solutions, return status in v0:

a. v0:

-1: imaginary,

1: 1 solution, x in f0, or

2: 2 solutions, x1, x2 in f0 and f1.

b. Must call sqrt to compute the square root.

c. Must be a reentrant subprogram and use register call convention.

3. float sqrt(float x) – return the square root of x

Required I/O:

Quadratic Equation Solver by F. Last

Enter values for a? #

Enter values for b? #

Enter values for c? #

is a blank line. F. Last is your first initial and last name, # is user input.

1. If a = 0 && b = 0:

Not a quadratic equation.

2. If a = 0 and b != 0, linear equation, x = -c / b

x = #.#

3. If discriminant < 0:

Roots are imaginary.

4. Otherwise

x1 = #.#

x2 = #.#

#.# are replaced with calculated root(s)

Hints:

solveqe pseudocode:

if a = 0

if b = 0

return 0 (v0)

else

x = -c / b

return 1, x (v0, f0)

d = b2

– 4ac

if (d < 0)

return -1 (v0)

else {

compute x1 and x2

return 2, x1, x2 (v0, f0, f1)

}

* ONLY main will output anything

* sovleqe and sqrt DO NOT output anything.

* sqrt.f can be used in procedure sqrt or you can implement your own

Kĩ năng: Lắp ráp

Về Bên Thuê:
( 1 Nhận xét ) Woodside, United States

ID dự án: #30134120

## 3 freelancer chào giá trung bình\$27 cho công việc này

sayanthanpera

I can start now..........................................................................................................

\$40 USD trong 1 ngày
(4 Nhận xét)
2.8
ramyan2021

I have 12+year of experience in C , C++ and MIPS Assembly programming and i can implement implement this. Please ping me so we can work on this.

\$20 USD trong 7 ngày
(2 Nhận xét)
2.3
Engrusman877

Hi There, I am an embedded system expert and an electronics engineer having expertise in assembly, MIPS, SIMD, Verilog and vhdl. just share your further details if you have some deadline to work on. Thanks

\$20 USD trong 7 ngày
(1 Nhận xét)
0.9