<<>> <> <> <> <> DIRECTORY RealFns USING [SqRt], Quadratic; QuadraticImpl: CEDAR PROGRAM IMPORTS RealFns EXPORTS Quadratic = BEGIN Roots: TYPE = Quadratic.Roots; RealRoots: PUBLIC PROCEDURE [a,b,c:REAL] RETURNS [Roots] = BEGIN IF a#0 THEN BEGIN d: REAL; b ¬ b/a; c ¬ c/a; <> d ¬ b*b-4*c; IF d<0 THEN RETURN [[0,99.9,99.9]]; d ¬ RealFns.SqRt[d]; RETURN[[2,(-b-d)/2,(-b+d)/2]]; END ELSE IF b#0 THEN RETURN[[1,-c/b,99.9]] ELSE RETURN[[0,0.0,0.0]] END; END.