-- Find the roots of a quadratic ax^2 + bx + c 

-- This is a variation on an earlier version discussed in lectures.

-- A quadratic may have 0, 1, or 2 real roots.
-- One way to handle the variation is to return a list of roots.
-- The list will be of length 0, 1 or 2.


roots :: Float -> Float -> Float -> [Float]
roots a b c
    | discriminant == 0  = [ -b/(2*a) ]
    | discriminant >  0  = [ (-b + (sqrt discriminant))/(2*a), 
			     (-b - (sqrt discriminant))/(2*a) ]
    | otherwise          = []
    where
    discriminant = b^2 - 4*a*c

