Finding all zeros of a cubic function