Cody

# Problem 42987. Roots of a quadratic equation.

Solution 1973772

Submitted on 13 Oct 2019 by Nikolaos Nikolaou
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
a=1; b=2; c=1; y_correct = [-1 -1]; assert(norm(quadRoots(a,b,c)-y_correct) < 10*eps)

y = -1 -1 y = -1 -1 y = -1 -1

2   Pass
a=1; b=-5; c=6; y_correct = [2 3]; assert(norm(quadRoots(a,b,c)-y_correct) < 10*eps)

y = 3.0000 2.0000 y = 2.0000 3.0000 y = 2.0000 3.0000

3   Pass
a=1; b=5; c=6; y_correct = [-3 -2]; assert(norm(quadRoots(a,b,c)-y_correct) < 10*eps)

y = -3.0000 -2.0000 y = -3.0000 -2.0000 y = -3.0000 -2.0000

4   Pass
a=2; b=10; c=12; y_correct = [-3 -2]; assert(norm(quadRoots(a,b,c)-y_correct) < 10*eps)

y = -3.0000 -2.0000 y = -3.0000 -2.0000 y = -3.0000 -2.0000

5   Pass
a=1; b=19; c=90; y_correct = [-10 -9]; assert(norm(quadRoots(a,b,c)-y_correct) < 100*eps)

y = -10 -9 y = -10 -9 y = -10 -9