Project: Cubic Roots
Cubic equations of the form Ax3 + Bx2 + Cx + D = 0 have three possible solutions given by the [[Cubic Formula]]. Write a program that sets the constants A = 1, B = -6, C = 11 and D = -6 then prints the three possible solutions. Then change the constants A, B, C and D to get solutions to other quadratic equations. Is it possible that this program could fail?
Output
$ perl CubicRoots.pl
root #1: 3
root #2: 2
root #3: 1