x3 + px + q = 0.
For a given solution x, let a and b be numbers satisfying a-b = x and ab = p/3. Combine these equations to give a quadratic, hence a and b can be derived, at least in theory, from x and p. Once a and b are found, the "other" ab pair, associated with x and p, is produced by swapping and negating a and b. Substitute x = a-b in the original polynomial to get,
a3 - b3 + q = 0.
Multiply through by 27a3, remembering that ab = p. The result is a quadratic in a3:
27a6 + 27qa3 - p3 = 0
Apply the quadratic formula, and take the cube root of the result. The 6 values of a group into three pairs, whose product is -3p and sum is x. All this can be expanded into a closed formula, but it would be messy. No matter, a computer can handle it.
This procedure won't work in rings with characteristic 2 or 3.