Return roots[3] where each root is complex (i.e., has both roots[*].re and roots[*].im ).
nRoots helps to identify the number of expected real roots based on the result from the polynomial discriminant, D.
function ccubicRoots import TRANSFORM.Math.ComplexMath.csqrt; import 'abs' = Modelica.ComplexMath.abs; input Real a; input Real b; input Real c; input Real d; output Complex[3] roots "Real roots"; output Real nRoots "Number of distinct real solutions expected"; end ccubicRoots;