Rename & refactor cubic solver

Renamed CalcRoots to CalcCubicRoots, refactored common code into FindCubicRoot.
Created function SortRoots to extract code that has been copy-pasted in various files into 1 place.