theres a very similar cubic roots solution in the DOOM3 code release (they use an assert for a == 0.0)