2-ancestry mixing, positive discriminant

Percentage Accurate: 43.3% → 72.3%
Time: 10.6s
Alternatives: 6
Speedup: 1.3×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{2 \cdot a}\\ t_1 := \sqrt{g \cdot g - h \cdot h}\\ \sqrt[3]{t\_0 \cdot \left(\left(-g\right) + t\_1\right)} + \sqrt[3]{t\_0 \cdot \left(\left(-g\right) - t\_1\right)} \end{array} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* 2.0 a))) (t_1 (sqrt (- (* g g) (* h h)))))
   (+ (cbrt (* t_0 (+ (- g) t_1))) (cbrt (* t_0 (- (- g) t_1))))))
double code(double g, double h, double a) {
	double t_0 = 1.0 / (2.0 * a);
	double t_1 = sqrt(((g * g) - (h * h)));
	return cbrt((t_0 * (-g + t_1))) + cbrt((t_0 * (-g - t_1)));
}
public static double code(double g, double h, double a) {
	double t_0 = 1.0 / (2.0 * a);
	double t_1 = Math.sqrt(((g * g) - (h * h)));
	return Math.cbrt((t_0 * (-g + t_1))) + Math.cbrt((t_0 * (-g - t_1)));
}
function code(g, h, a)
	t_0 = Float64(1.0 / Float64(2.0 * a))
	t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h)))
	return Float64(cbrt(Float64(t_0 * Float64(Float64(-g) + t_1))) + cbrt(Float64(t_0 * Float64(Float64(-g) - t_1))))
end
code[g_, h_, a_] := Block[{t$95$0 = N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(t$95$0 * N[((-g) + t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(t$95$0 * N[((-g) - t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{2 \cdot a}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
\sqrt[3]{t\_0 \cdot \left(\left(-g\right) + t\_1\right)} + \sqrt[3]{t\_0 \cdot \left(\left(-g\right) - t\_1\right)}
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 43.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{2 \cdot a}\\ t_1 := \sqrt{g \cdot g - h \cdot h}\\ \sqrt[3]{t\_0 \cdot \left(\left(-g\right) + t\_1\right)} + \sqrt[3]{t\_0 \cdot \left(\left(-g\right) - t\_1\right)} \end{array} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* 2.0 a))) (t_1 (sqrt (- (* g g) (* h h)))))
   (+ (cbrt (* t_0 (+ (- g) t_1))) (cbrt (* t_0 (- (- g) t_1))))))
double code(double g, double h, double a) {
	double t_0 = 1.0 / (2.0 * a);
	double t_1 = sqrt(((g * g) - (h * h)));
	return cbrt((t_0 * (-g + t_1))) + cbrt((t_0 * (-g - t_1)));
}
public static double code(double g, double h, double a) {
	double t_0 = 1.0 / (2.0 * a);
	double t_1 = Math.sqrt(((g * g) - (h * h)));
	return Math.cbrt((t_0 * (-g + t_1))) + Math.cbrt((t_0 * (-g - t_1)));
}
function code(g, h, a)
	t_0 = Float64(1.0 / Float64(2.0 * a))
	t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h)))
	return Float64(cbrt(Float64(t_0 * Float64(Float64(-g) + t_1))) + cbrt(Float64(t_0 * Float64(Float64(-g) - t_1))))
end
code[g_, h_, a_] := Block[{t$95$0 = N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(t$95$0 * N[((-g) + t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(t$95$0 * N[((-g) - t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{2 \cdot a}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
\sqrt[3]{t\_0 \cdot \left(\left(-g\right) + t\_1\right)} + \sqrt[3]{t\_0 \cdot \left(\left(-g\right) - t\_1\right)}
\end{array}
\end{array}

Alternative 1: 72.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{2 \cdot a}\\ t_1 := \sqrt{g \cdot g - h \cdot h}\\ t_2 := \sqrt[3]{\left(g + t\_1\right) \cdot \frac{-1}{2 \cdot a}}\\ \mathbf{if}\;\sqrt[3]{t\_0 \cdot \left(t\_1 - g\right)} + t\_2 \leq -\infty:\\ \;\;\;\;t\_2 + g \cdot \mathsf{fma}\left(0.16666666666666666, \frac{\sqrt[3]{\frac{1}{a \cdot {g}^{8}}} \cdot \left(\left(h \cdot h\right) \cdot \sqrt[3]{0.5}\right)}{{\left(\sqrt[3]{-2}\right)}^{2}}, \sqrt[3]{\frac{1}{a \cdot \left(g \cdot g\right)}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{t\_0 \cdot \frac{\left(h \cdot h\right) \cdot -0.5}{g}} + \sqrt[3]{t\_0 \cdot \left(g \cdot -2\right)}\\ \end{array} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* 2.0 a)))
        (t_1 (sqrt (- (* g g) (* h h))))
        (t_2 (cbrt (* (+ g t_1) (/ -1.0 (* 2.0 a))))))
   (if (<= (+ (cbrt (* t_0 (- t_1 g))) t_2) (- INFINITY))
     (+
      t_2
      (*
       g
       (fma
        0.16666666666666666
        (/
         (* (cbrt (/ 1.0 (* a (pow g 8.0)))) (* (* h h) (cbrt 0.5)))
         (pow (cbrt -2.0) 2.0))
        (* (cbrt (/ 1.0 (* a (* g g)))) (* (cbrt 0.5) (cbrt -2.0))))))
     (+ (cbrt (* t_0 (/ (* (* h h) -0.5) g))) (cbrt (* t_0 (* g -2.0)))))))
double code(double g, double h, double a) {
	double t_0 = 1.0 / (2.0 * a);
	double t_1 = sqrt(((g * g) - (h * h)));
	double t_2 = cbrt(((g + t_1) * (-1.0 / (2.0 * a))));
	double tmp;
	if ((cbrt((t_0 * (t_1 - g))) + t_2) <= -((double) INFINITY)) {
		tmp = t_2 + (g * fma(0.16666666666666666, ((cbrt((1.0 / (a * pow(g, 8.0)))) * ((h * h) * cbrt(0.5))) / pow(cbrt(-2.0), 2.0)), (cbrt((1.0 / (a * (g * g)))) * (cbrt(0.5) * cbrt(-2.0)))));
	} else {
		tmp = cbrt((t_0 * (((h * h) * -0.5) / g))) + cbrt((t_0 * (g * -2.0)));
	}
	return tmp;
}
function code(g, h, a)
	t_0 = Float64(1.0 / Float64(2.0 * a))
	t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h)))
	t_2 = cbrt(Float64(Float64(g + t_1) * Float64(-1.0 / Float64(2.0 * a))))
	tmp = 0.0
	if (Float64(cbrt(Float64(t_0 * Float64(t_1 - g))) + t_2) <= Float64(-Inf))
		tmp = Float64(t_2 + Float64(g * fma(0.16666666666666666, Float64(Float64(cbrt(Float64(1.0 / Float64(a * (g ^ 8.0)))) * Float64(Float64(h * h) * cbrt(0.5))) / (cbrt(-2.0) ^ 2.0)), Float64(cbrt(Float64(1.0 / Float64(a * Float64(g * g)))) * Float64(cbrt(0.5) * cbrt(-2.0))))));
	else
		tmp = Float64(cbrt(Float64(t_0 * Float64(Float64(Float64(h * h) * -0.5) / g))) + cbrt(Float64(t_0 * Float64(g * -2.0))));
	end
	return tmp
end
code[g_, h_, a_] := Block[{t$95$0 = N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(N[(g + t$95$1), $MachinePrecision] * N[(-1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(t$95$0 * N[(t$95$1 - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + t$95$2), $MachinePrecision], (-Infinity)], N[(t$95$2 + N[(g * N[(0.16666666666666666 * N[(N[(N[Power[N[(1.0 / N[(a * N[Power[g, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * N[(N[(h * h), $MachinePrecision] * N[Power[0.5, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[Power[-2.0, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[(1.0 / N[(a * N[(g * g), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * N[(N[Power[0.5, 1/3], $MachinePrecision] * N[Power[-2.0, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(t$95$0 * N[(N[(N[(h * h), $MachinePrecision] * -0.5), $MachinePrecision] / g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(t$95$0 * N[(g * -2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{2 \cdot a}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
t_2 := \sqrt[3]{\left(g + t\_1\right) \cdot \frac{-1}{2 \cdot a}}\\
\mathbf{if}\;\sqrt[3]{t\_0 \cdot \left(t\_1 - g\right)} + t\_2 \leq -\infty:\\
\;\;\;\;t\_2 + g \cdot \mathsf{fma}\left(0.16666666666666666, \frac{\sqrt[3]{\frac{1}{a \cdot {g}^{8}}} \cdot \left(\left(h \cdot h\right) \cdot \sqrt[3]{0.5}\right)}{{\left(\sqrt[3]{-2}\right)}^{2}}, \sqrt[3]{\frac{1}{a \cdot \left(g \cdot g\right)}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-2}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{t\_0 \cdot \frac{\left(h \cdot h\right) \cdot -0.5}{g}} + \sqrt[3]{t\_0 \cdot \left(g \cdot -2\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) < -inf.0

    1. Initial program 4.4%

      \[\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in g around -inf

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \color{blue}{-1 \cdot \left(g \cdot \left(1 + \frac{-1}{2} \cdot \frac{{h}^{2}}{{g}^{2}}\right)\right)}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \color{blue}{\left(\mathsf{neg}\left(g \cdot \left(1 + \frac{-1}{2} \cdot \frac{{h}^{2}}{{g}^{2}}\right)\right)\right)}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      2. *-commutativeN/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot \frac{{h}^{2}}{{g}^{2}}\right) \cdot g}\right)\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \color{blue}{\left(1 + \frac{-1}{2} \cdot \frac{{h}^{2}}{{g}^{2}}\right) \cdot \left(\mathsf{neg}\left(g\right)\right)}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \color{blue}{\left(1 + \frac{-1}{2} \cdot \frac{{h}^{2}}{{g}^{2}}\right) \cdot \left(\mathsf{neg}\left(g\right)\right)}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      5. +-commutativeN/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \color{blue}{\left(\frac{-1}{2} \cdot \frac{{h}^{2}}{{g}^{2}} + 1\right)} \cdot \left(\mathsf{neg}\left(g\right)\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      6. associate-*r/N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \left(\color{blue}{\frac{\frac{-1}{2} \cdot {h}^{2}}{{g}^{2}}} + 1\right) \cdot \left(\mathsf{neg}\left(g\right)\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      7. *-commutativeN/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \left(\frac{\color{blue}{{h}^{2} \cdot \frac{-1}{2}}}{{g}^{2}} + 1\right) \cdot \left(\mathsf{neg}\left(g\right)\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      8. associate-/l*N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \left(\color{blue}{{h}^{2} \cdot \frac{\frac{-1}{2}}{{g}^{2}}} + 1\right) \cdot \left(\mathsf{neg}\left(g\right)\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      9. lower-fma.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \color{blue}{\mathsf{fma}\left({h}^{2}, \frac{\frac{-1}{2}}{{g}^{2}}, 1\right)} \cdot \left(\mathsf{neg}\left(g\right)\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      10. unpow2N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \mathsf{fma}\left(\color{blue}{h \cdot h}, \frac{\frac{-1}{2}}{{g}^{2}}, 1\right) \cdot \left(\mathsf{neg}\left(g\right)\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      11. lower-*.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \mathsf{fma}\left(\color{blue}{h \cdot h}, \frac{\frac{-1}{2}}{{g}^{2}}, 1\right) \cdot \left(\mathsf{neg}\left(g\right)\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      12. lower-/.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \mathsf{fma}\left(h \cdot h, \color{blue}{\frac{\frac{-1}{2}}{{g}^{2}}}, 1\right) \cdot \left(\mathsf{neg}\left(g\right)\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      13. unpow2N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \mathsf{fma}\left(h \cdot h, \frac{\frac{-1}{2}}{\color{blue}{g \cdot g}}, 1\right) \cdot \left(\mathsf{neg}\left(g\right)\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      14. lower-*.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \mathsf{fma}\left(h \cdot h, \frac{\frac{-1}{2}}{\color{blue}{g \cdot g}}, 1\right) \cdot \left(\mathsf{neg}\left(g\right)\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      15. lower-neg.f644.4

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \mathsf{fma}\left(h \cdot h, \frac{-0.5}{g \cdot g}, 1\right) \cdot \color{blue}{\left(-g\right)}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
    5. Simplified4.4%

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \color{blue}{\mathsf{fma}\left(h \cdot h, \frac{-0.5}{g \cdot g}, 1\right) \cdot \left(-g\right)}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
    6. Taylor expanded in g around inf

      \[\leadsto \color{blue}{g \cdot \left(\frac{1}{6} \cdot \left(\sqrt[3]{\frac{1}{a \cdot {g}^{8}}} \cdot \frac{{h}^{2} \cdot \sqrt[3]{\frac{1}{2}}}{{\left(\sqrt[3]{-2}\right)}^{2}}\right) + \sqrt[3]{\frac{1}{a \cdot {g}^{2}}} \cdot \left(\sqrt[3]{-2} \cdot \sqrt[3]{\frac{1}{2}}\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{g \cdot \left(\frac{1}{6} \cdot \left(\sqrt[3]{\frac{1}{a \cdot {g}^{8}}} \cdot \frac{{h}^{2} \cdot \sqrt[3]{\frac{1}{2}}}{{\left(\sqrt[3]{-2}\right)}^{2}}\right) + \sqrt[3]{\frac{1}{a \cdot {g}^{2}}} \cdot \left(\sqrt[3]{-2} \cdot \sqrt[3]{\frac{1}{2}}\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto g \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{6}, \sqrt[3]{\frac{1}{a \cdot {g}^{8}}} \cdot \frac{{h}^{2} \cdot \sqrt[3]{\frac{1}{2}}}{{\left(\sqrt[3]{-2}\right)}^{2}}, \sqrt[3]{\frac{1}{a \cdot {g}^{2}}} \cdot \left(\sqrt[3]{-2} \cdot \sqrt[3]{\frac{1}{2}}\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
    8. Simplified97.8%

      \[\leadsto \color{blue}{g \cdot \mathsf{fma}\left(0.16666666666666666, \frac{\sqrt[3]{\frac{1}{a \cdot {g}^{8}}} \cdot \left(\left(h \cdot h\right) \cdot \sqrt[3]{0.5}\right)}{{\left(\sqrt[3]{-2}\right)}^{2}}, \sqrt[3]{\frac{1}{a \cdot \left(g \cdot g\right)}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-2}\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]

    if -inf.0 < (+.f64 (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))))

    1. Initial program 42.2%

      \[\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in g around inf

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(-2 \cdot g\right)}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
      2. lower-*.f6425.5

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
    5. Simplified25.5%

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
    6. Taylor expanded in g around inf

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(\frac{-1}{2} \cdot \frac{{h}^{2}}{g}\right)}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    7. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{\frac{-1}{2} \cdot {h}^{2}}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
      2. lower-/.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{\frac{-1}{2} \cdot {h}^{2}}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\color{blue}{\frac{-1}{2} \cdot {h}^{2}}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
      4. unpow2N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \color{blue}{\left(h \cdot h\right)}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
      5. lower-*.f6472.3

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{-0.5 \cdot \color{blue}{\left(h \cdot h\right)}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    8. Simplified72.3%

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{-0.5 \cdot \left(h \cdot h\right)}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification72.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\sqrt{g \cdot g - h \cdot h} - g\right)} + \sqrt[3]{\left(g + \sqrt{g \cdot g - h \cdot h}\right) \cdot \frac{-1}{2 \cdot a}} \leq -\infty:\\ \;\;\;\;\sqrt[3]{\left(g + \sqrt{g \cdot g - h \cdot h}\right) \cdot \frac{-1}{2 \cdot a}} + g \cdot \mathsf{fma}\left(0.16666666666666666, \frac{\sqrt[3]{\frac{1}{a \cdot {g}^{8}}} \cdot \left(\left(h \cdot h\right) \cdot \sqrt[3]{0.5}\right)}{{\left(\sqrt[3]{-2}\right)}^{2}}, \sqrt[3]{\frac{1}{a \cdot \left(g \cdot g\right)}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\left(h \cdot h\right) \cdot -0.5}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 71.4% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{2 \cdot a}\\ \sqrt[3]{t\_0 \cdot \frac{\left(h \cdot h\right) \cdot -0.5}{g}} + \sqrt[3]{t\_0 \cdot \left(g \cdot -2\right)} \end{array} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* 2.0 a))))
   (+ (cbrt (* t_0 (/ (* (* h h) -0.5) g))) (cbrt (* t_0 (* g -2.0))))))
double code(double g, double h, double a) {
	double t_0 = 1.0 / (2.0 * a);
	return cbrt((t_0 * (((h * h) * -0.5) / g))) + cbrt((t_0 * (g * -2.0)));
}
public static double code(double g, double h, double a) {
	double t_0 = 1.0 / (2.0 * a);
	return Math.cbrt((t_0 * (((h * h) * -0.5) / g))) + Math.cbrt((t_0 * (g * -2.0)));
}
function code(g, h, a)
	t_0 = Float64(1.0 / Float64(2.0 * a))
	return Float64(cbrt(Float64(t_0 * Float64(Float64(Float64(h * h) * -0.5) / g))) + cbrt(Float64(t_0 * Float64(g * -2.0))))
end
code[g_, h_, a_] := Block[{t$95$0 = N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(t$95$0 * N[(N[(N[(h * h), $MachinePrecision] * -0.5), $MachinePrecision] / g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(t$95$0 * N[(g * -2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{2 \cdot a}\\
\sqrt[3]{t\_0 \cdot \frac{\left(h \cdot h\right) \cdot -0.5}{g}} + \sqrt[3]{t\_0 \cdot \left(g \cdot -2\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 41.5%

    \[\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in g around inf

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(-2 \cdot g\right)}} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
    2. lower-*.f6425.0

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
  5. Simplified25.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
  6. Taylor expanded in g around inf

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(\frac{-1}{2} \cdot \frac{{h}^{2}}{g}\right)}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  7. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{\frac{-1}{2} \cdot {h}^{2}}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    2. lower-/.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{\frac{-1}{2} \cdot {h}^{2}}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    3. lower-*.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\color{blue}{\frac{-1}{2} \cdot {h}^{2}}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    4. unpow2N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \color{blue}{\left(h \cdot h\right)}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    5. lower-*.f6471.0

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{-0.5 \cdot \color{blue}{\left(h \cdot h\right)}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  8. Simplified71.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{-0.5 \cdot \left(h \cdot h\right)}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  9. Final simplification71.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\left(h \cdot h\right) \cdot -0.5}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  10. Add Preprocessing

Alternative 3: 71.5% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\left(h \cdot h\right) \cdot -0.5}{g}} - \sqrt[3]{\frac{g}{a}} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (- (cbrt (* (/ 1.0 (* 2.0 a)) (/ (* (* h h) -0.5) g))) (cbrt (/ g a))))
double code(double g, double h, double a) {
	return cbrt(((1.0 / (2.0 * a)) * (((h * h) * -0.5) / g))) - cbrt((g / a));
}
public static double code(double g, double h, double a) {
	return Math.cbrt(((1.0 / (2.0 * a)) * (((h * h) * -0.5) / g))) - Math.cbrt((g / a));
}
function code(g, h, a)
	return Float64(cbrt(Float64(Float64(1.0 / Float64(2.0 * a)) * Float64(Float64(Float64(h * h) * -0.5) / g))) - cbrt(Float64(g / a)))
end
code[g_, h_, a_] := N[(N[Power[N[(N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h * h), $MachinePrecision] * -0.5), $MachinePrecision] / g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\left(h \cdot h\right) \cdot -0.5}{g}} - \sqrt[3]{\frac{g}{a}}
\end{array}
Derivation
  1. Initial program 41.5%

    \[\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in g around inf

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(-2 \cdot g\right)}} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
    2. lower-*.f6425.0

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
  5. Simplified25.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
  6. Taylor expanded in g around inf

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(\frac{-1}{2} \cdot \frac{{h}^{2}}{g}\right)}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  7. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{\frac{-1}{2} \cdot {h}^{2}}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    2. lower-/.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{\frac{-1}{2} \cdot {h}^{2}}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    3. lower-*.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\color{blue}{\frac{-1}{2} \cdot {h}^{2}}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    4. unpow2N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \color{blue}{\left(h \cdot h\right)}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    5. lower-*.f6471.0

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{-0.5 \cdot \color{blue}{\left(h \cdot h\right)}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  8. Simplified71.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{-0.5 \cdot \left(h \cdot h\right)}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  9. Taylor expanded in g around -inf

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \left(h \cdot h\right)}{g}} + \color{blue}{-1 \cdot \sqrt[3]{\frac{g}{a}}} \]
  10. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \left(h \cdot h\right)}{g}} + \color{blue}{\left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right)} \]
    2. lower-neg.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \left(h \cdot h\right)}{g}} + \color{blue}{\left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right)} \]
    3. lower-cbrt.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \left(h \cdot h\right)}{g}} + \left(\mathsf{neg}\left(\color{blue}{\sqrt[3]{\frac{g}{a}}}\right)\right) \]
    4. lower-/.f6471.0

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{-0.5 \cdot \left(h \cdot h\right)}{g}} + \left(-\sqrt[3]{\color{blue}{\frac{g}{a}}}\right) \]
  11. Simplified71.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{-0.5 \cdot \left(h \cdot h\right)}{g}} + \color{blue}{\left(-\sqrt[3]{\frac{g}{a}}\right)} \]
  12. Final simplification71.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\left(h \cdot h\right) \cdot -0.5}{g}} - \sqrt[3]{\frac{g}{a}} \]
  13. Add Preprocessing

Alternative 4: 68.1% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} + \sqrt[3]{\frac{\left(h \cdot h\right) \cdot -0.25}{a \cdot g}} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (+
  (cbrt (* (/ 1.0 (* 2.0 a)) (* g -2.0)))
  (cbrt (/ (* (* h h) -0.25) (* a g)))))
double code(double g, double h, double a) {
	return cbrt(((1.0 / (2.0 * a)) * (g * -2.0))) + cbrt((((h * h) * -0.25) / (a * g)));
}
public static double code(double g, double h, double a) {
	return Math.cbrt(((1.0 / (2.0 * a)) * (g * -2.0))) + Math.cbrt((((h * h) * -0.25) / (a * g)));
}
function code(g, h, a)
	return Float64(cbrt(Float64(Float64(1.0 / Float64(2.0 * a)) * Float64(g * -2.0))) + cbrt(Float64(Float64(Float64(h * h) * -0.25) / Float64(a * g))))
end
code[g_, h_, a_] := N[(N[Power[N[(N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * N[(g * -2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(N[(h * h), $MachinePrecision] * -0.25), $MachinePrecision] / N[(a * g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} + \sqrt[3]{\frac{\left(h \cdot h\right) \cdot -0.25}{a \cdot g}}
\end{array}
Derivation
  1. Initial program 41.5%

    \[\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in g around inf

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(-2 \cdot g\right)}} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
    2. lower-*.f6425.0

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
  5. Simplified25.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
  6. Taylor expanded in g around inf

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(\frac{-1}{2} \cdot \frac{{h}^{2}}{g}\right)}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  7. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{\frac{-1}{2} \cdot {h}^{2}}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    2. lower-/.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{\frac{-1}{2} \cdot {h}^{2}}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    3. lower-*.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\color{blue}{\frac{-1}{2} \cdot {h}^{2}}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    4. unpow2N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \color{blue}{\left(h \cdot h\right)}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    5. lower-*.f6471.0

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{-0.5 \cdot \color{blue}{\left(h \cdot h\right)}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  8. Simplified71.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{-0.5 \cdot \left(h \cdot h\right)}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  9. Taylor expanded in a around 0

    \[\leadsto \sqrt[3]{\color{blue}{\frac{-1}{4} \cdot \frac{{h}^{2}}{a \cdot g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  10. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \sqrt[3]{\color{blue}{\frac{\frac{-1}{4} \cdot {h}^{2}}{a \cdot g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    2. lower-/.f64N/A

      \[\leadsto \sqrt[3]{\color{blue}{\frac{\frac{-1}{4} \cdot {h}^{2}}{a \cdot g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    3. lower-*.f64N/A

      \[\leadsto \sqrt[3]{\frac{\color{blue}{\frac{-1}{4} \cdot {h}^{2}}}{a \cdot g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    4. unpow2N/A

      \[\leadsto \sqrt[3]{\frac{\frac{-1}{4} \cdot \color{blue}{\left(h \cdot h\right)}}{a \cdot g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    5. lower-*.f64N/A

      \[\leadsto \sqrt[3]{\frac{\frac{-1}{4} \cdot \color{blue}{\left(h \cdot h\right)}}{a \cdot g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    6. lower-*.f6466.9

      \[\leadsto \sqrt[3]{\frac{-0.25 \cdot \left(h \cdot h\right)}{\color{blue}{a \cdot g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  11. Simplified66.9%

    \[\leadsto \sqrt[3]{\color{blue}{\frac{-0.25 \cdot \left(h \cdot h\right)}{a \cdot g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  12. Final simplification66.9%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} + \sqrt[3]{\frac{\left(h \cdot h\right) \cdot -0.25}{a \cdot g}} \]
  13. Add Preprocessing

Alternative 5: 68.3% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \sqrt[3]{\frac{\left(h \cdot h\right) \cdot -0.25}{a \cdot g}} - \sqrt[3]{\frac{g}{a}} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (- (cbrt (/ (* (* h h) -0.25) (* a g))) (cbrt (/ g a))))
double code(double g, double h, double a) {
	return cbrt((((h * h) * -0.25) / (a * g))) - cbrt((g / a));
}
public static double code(double g, double h, double a) {
	return Math.cbrt((((h * h) * -0.25) / (a * g))) - Math.cbrt((g / a));
}
function code(g, h, a)
	return Float64(cbrt(Float64(Float64(Float64(h * h) * -0.25) / Float64(a * g))) - cbrt(Float64(g / a)))
end
code[g_, h_, a_] := N[(N[Power[N[(N[(N[(h * h), $MachinePrecision] * -0.25), $MachinePrecision] / N[(a * g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt[3]{\frac{\left(h \cdot h\right) \cdot -0.25}{a \cdot g}} - \sqrt[3]{\frac{g}{a}}
\end{array}
Derivation
  1. Initial program 41.5%

    \[\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in g around inf

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(-2 \cdot g\right)}} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
    2. lower-*.f6425.0

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
  5. Simplified25.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
  6. Taylor expanded in g around inf

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(\frac{-1}{2} \cdot \frac{{h}^{2}}{g}\right)}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  7. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{\frac{-1}{2} \cdot {h}^{2}}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    2. lower-/.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{\frac{-1}{2} \cdot {h}^{2}}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    3. lower-*.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\color{blue}{\frac{-1}{2} \cdot {h}^{2}}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    4. unpow2N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \color{blue}{\left(h \cdot h\right)}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    5. lower-*.f6471.0

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{-0.5 \cdot \color{blue}{\left(h \cdot h\right)}}{g}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  8. Simplified71.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\frac{-0.5 \cdot \left(h \cdot h\right)}{g}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  9. Taylor expanded in g around -inf

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \left(h \cdot h\right)}{g}} + \color{blue}{-1 \cdot \sqrt[3]{\frac{g}{a}}} \]
  10. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \left(h \cdot h\right)}{g}} + \color{blue}{\left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right)} \]
    2. lower-neg.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \left(h \cdot h\right)}{g}} + \color{blue}{\left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right)} \]
    3. lower-cbrt.f64N/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\frac{-1}{2} \cdot \left(h \cdot h\right)}{g}} + \left(\mathsf{neg}\left(\color{blue}{\sqrt[3]{\frac{g}{a}}}\right)\right) \]
    4. lower-/.f6471.0

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{-0.5 \cdot \left(h \cdot h\right)}{g}} + \left(-\sqrt[3]{\color{blue}{\frac{g}{a}}}\right) \]
  11. Simplified71.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{-0.5 \cdot \left(h \cdot h\right)}{g}} + \color{blue}{\left(-\sqrt[3]{\frac{g}{a}}\right)} \]
  12. Taylor expanded in a around 0

    \[\leadsto \sqrt[3]{\color{blue}{\frac{-1}{4} \cdot \frac{{h}^{2}}{a \cdot g}}} + \left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right) \]
  13. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \sqrt[3]{\color{blue}{\frac{\frac{-1}{4} \cdot {h}^{2}}{a \cdot g}}} + \left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right) \]
    2. lower-/.f64N/A

      \[\leadsto \sqrt[3]{\color{blue}{\frac{\frac{-1}{4} \cdot {h}^{2}}{a \cdot g}}} + \left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right) \]
    3. lower-*.f64N/A

      \[\leadsto \sqrt[3]{\frac{\color{blue}{\frac{-1}{4} \cdot {h}^{2}}}{a \cdot g}} + \left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right) \]
    4. unpow2N/A

      \[\leadsto \sqrt[3]{\frac{\frac{-1}{4} \cdot \color{blue}{\left(h \cdot h\right)}}{a \cdot g}} + \left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right) \]
    5. lower-*.f64N/A

      \[\leadsto \sqrt[3]{\frac{\frac{-1}{4} \cdot \color{blue}{\left(h \cdot h\right)}}{a \cdot g}} + \left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right) \]
    6. lower-*.f6466.9

      \[\leadsto \sqrt[3]{\frac{-0.25 \cdot \left(h \cdot h\right)}{\color{blue}{a \cdot g}}} + \left(-\sqrt[3]{\frac{g}{a}}\right) \]
  14. Simplified66.9%

    \[\leadsto \sqrt[3]{\color{blue}{\frac{-0.25 \cdot \left(h \cdot h\right)}{a \cdot g}}} + \left(-\sqrt[3]{\frac{g}{a}}\right) \]
  15. Final simplification66.9%

    \[\leadsto \sqrt[3]{\frac{\left(h \cdot h\right) \cdot -0.25}{a \cdot g}} - \sqrt[3]{\frac{g}{a}} \]
  16. Add Preprocessing

Alternative 6: 15.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt[3]{\frac{g}{a}}\\ \left(-t\_0\right) - t\_0 \end{array} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (let* ((t_0 (cbrt (/ g a)))) (- (- t_0) t_0)))
double code(double g, double h, double a) {
	double t_0 = cbrt((g / a));
	return -t_0 - t_0;
}
public static double code(double g, double h, double a) {
	double t_0 = Math.cbrt((g / a));
	return -t_0 - t_0;
}
function code(g, h, a)
	t_0 = cbrt(Float64(g / a))
	return Float64(Float64(-t_0) - t_0)
end
code[g_, h_, a_] := Block[{t$95$0 = N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]}, N[((-t$95$0) - t$95$0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt[3]{\frac{g}{a}}\\
\left(-t\_0\right) - t\_0
\end{array}
\end{array}
Derivation
  1. Initial program 41.5%

    \[\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in g around inf

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(-2 \cdot g\right)}} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
    2. lower-*.f6425.0

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
  5. Simplified25.0%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
  6. Taylor expanded in g around -inf

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(-2 \cdot g\right)}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  7. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    2. lower-*.f6415.2

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  8. Simplified15.2%

    \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  9. Taylor expanded in g around -inf

    \[\leadsto \color{blue}{-1 \cdot \sqrt[3]{\frac{g}{a}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  10. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    2. lower-neg.f64N/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    3. lower-cbrt.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\sqrt[3]{\frac{g}{a}}}\right)\right) + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    4. lower-/.f6415.2

      \[\leadsto \left(-\sqrt[3]{\color{blue}{\frac{g}{a}}}\right) + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  11. Simplified15.2%

    \[\leadsto \color{blue}{\left(-\sqrt[3]{\frac{g}{a}}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
  12. Taylor expanded in g around -inf

    \[\leadsto \left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right) + \color{blue}{-1 \cdot \sqrt[3]{\frac{g}{a}}} \]
  13. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right)} \]
    2. lower-neg.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right)} \]
    3. lower-cbrt.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\sqrt[3]{\frac{g}{a}}}\right)\right) \]
    4. lower-/.f6415.2

      \[\leadsto \left(-\sqrt[3]{\frac{g}{a}}\right) + \left(-\sqrt[3]{\color{blue}{\frac{g}{a}}}\right) \]
  14. Simplified15.2%

    \[\leadsto \left(-\sqrt[3]{\frac{g}{a}}\right) + \color{blue}{\left(-\sqrt[3]{\frac{g}{a}}\right)} \]
  15. Final simplification15.2%

    \[\leadsto \left(-\sqrt[3]{\frac{g}{a}}\right) - \sqrt[3]{\frac{g}{a}} \]
  16. Add Preprocessing

Reproduce

?
herbie shell --seed 2024215 
(FPCore (g h a)
  :name "2-ancestry mixing, positive discriminant"
  :precision binary64
  (+ (cbrt (* (/ 1.0 (* 2.0 a)) (+ (- g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1.0 (* 2.0 a)) (- (- g) (sqrt (- (* g g) (* h h))))))))