As part of a program I\'m writing, I need to solve a cubic equation exactly (rather than using a numerical root finder):
a*x**3 + b*x**2 + c*x + d = 0.
I've looked at the Wikipedia article and your program.
I also solved the equation using Wolfram Alpha and the results there don't match what you get.
I'd just go through your program at each step, use a lot of print statements, and get each intermediate result. Then go through with a calculator and do it yourself.
I can't find what's happening, but where your hand calculations and the program diverge is a good place to look.