• Your program will take in the integer coefficients of the equation \$ax^3+bx^2+cx+d=0\$ as inputs (a, b, c, and d).


  • All real solutions of the input equation, with an accuracy of at least the thousandths place, sorted from smallest to largest.


  • Built-in equation solver are not allowed
  • Native math libraries that do not solve equations may be used
  • If you have any questions, please ask in comment


  1. .


    1 2 3 4


  2. .


    1 3 0 -1


    -2.879 -0.653 0.532
  • 6
    \$\begingroup\$ Challenges must have an objective scoring criterion. I would recommend code-golf. In future, please post your questions in the Sandbox first to get feedback. Also, disallowing built-in methods tends to lead to a less fun challenge \$\endgroup\$ – pxeger Jan 9 at 13:13
  • 13
    \$\begingroup\$ Also, I'd recommend against strict input/output methods like "separated by spaces", as it makes less of the challenge about solving the problem, but more boring boilerplate I/O logic \$\endgroup\$ – pxeger Jan 9 at 13:22
  • 18
    \$\begingroup\$ I'd strongly suggest loosening the challenge by removing the rules about space-separated input/output, required rounding, and output needing to be sorted. \$\endgroup\$ – xnor Jan 9 at 14:17
  • 4
    \$\begingroup\$ Does the output have to be uniqified, or can numbers repeat multiple times? \$\endgroup\$ – Command Master Jan 9 at 16:49
  • 4
    \$\begingroup\$ This is badly in need of a full explanation and a worked example. \$\endgroup\$ – Shaggy Jan 10 at 0:18

Browse other questions tagged or ask your own question.