Rational decomposition a = xyz(x+y+z)
CJam (59 bytes)
{[WZ~C24X8TT]f*[4XGYC6 4Y].+_0=!>2%Z65135Zb+:(3/.f#:.*)W*+}
This is an anonymous block (function) which takes an integer or double on the stack and produces an array with three doubles. It has two cases internally to handle all non-negative inputs, since with only one case it would break on either 0.25
or 4
. It still breaks for inputs -12
and -1.3333333333333333
, but the spec allows that...
The online demo executes it and then adds up the values, prints all four, and multiplies them to show that it gets the original value (modulo rounding error).
Mathematical background
Following Noam Elkies we define the auxiliary \$w = - x - y - z\$. Then \$x + y + z + w = 0\$ and \$-xyzw = a\$ or \$xyzw + a = 0\$. This has lots of symmetry; any solution will have four formulae and we can pick the three golfiest ones.
Elkies gives four families of sets of solutions. Euler's:
$$\begin{eqnarray*} x & = & \frac{6ast^3(at^4-2s^4)^2}{(4at^4+s^4)(2a^2t^8 + 10as^4t^4 - s^8)} \\ y & = & \frac{3s^5(4at^4+s^4)^2}{2t(at^4-2s^4)(2a^2t^8+10as^4t^4-s^8)} \\ z & = & \frac{2(2a^2t^8+10as^4t^4-s^8)}{3s^3t(4at^4+s^4)} \\ w & = & \frac{-(2a^2t^8+10as^4t^4-s^8)}{6s^3t(at^4-2s^4)} \end{eqnarray*}$$
One related to Euler's:
$$\begin{eqnarray*} x & = & \frac{(8s^8+a^2)(8s^8-88as^4-a^2)}{12s^3(s^4-a)(8s^8+20as^4-a^2)}\\ y & = & \frac{(8s^8+a^2)(8s^8-88as^4-a^2)}{12s^3(8s^4+a)(8s^8+20as^4-a^2)}\\ z & = & \frac{192as^5(s^4-a)^2(8s^4+a)^2}{(8s^8+a^2)(8s^8-88as^4-a^2)(8s^8+20as^4-a^2)}\\ w & = & \frac{-3s(8s^8+20as^4-a^2)^3}{4(s^4-a)(8s^4+a)(8s^8+a^2)(8s^8-88as^4-a^2)}\\ \end{eqnarray*}$$
A simpler one:
$$\begin{eqnarray*} x & = & \frac{(s^4-4a)^2}{2s^3(s^4+12a)} \\ y & = & \frac{2a(3s^4+4a)^2}{s^3(s^4-4a)(s^4+12a)} \\ z & = & \frac{s^5+12as}{2(3s^4+4a)} \\ w & = & \frac{-2s^5(s^4+12a)}{(s^4-4a)(3s^4+4a)} \\ \end{eqnarray*}$$
And one related to that one:
$$\begin{eqnarray*} x & = & \frac{s^5(s^4-3a)^3}{2(s^4+a)(s^{12}+12as^8-3a^2s^4+2a^3)} \\ y & = & \frac{s^{12}+12as^8-3a^2s^4+2a^3}{2s^3(s^4-3a)(3s^4-a)} \\ z & = & \frac{2a(s^4+a)^2(3s^4-a)^2}{s^3(s^4-3a)(s^{12}+12as^8-3a^2s^4+2a^3)} \\ w & = & \frac{-2s(s^{12}+12as^8-3a^2s^4+2a^3)}{(s^4-3a)(s^4+a)(3s^4-a)} \end{eqnarray*}$$
Observe that every family has at least two denominators of the form \$ps^4 - qa\$ for positive \$p\$ and \$q\$: since all the terms involved are rational, that means that there's some positive \$a\$ for which we get division by zero. Therefore we must use at least two sets of solutions which have their singularities at different values of \$a\$. Intuitively it's going to be golfiest to choose two sets from the same family. I've chosen the simplest family (the third one) with parameters \$s=1\$ and \$s=2\$.