2-ancestry mixing, positive discriminant

Percentage Accurate: 43.3% → 77.2%
Time: 12.5s
Alternatives: 7
Speedup: 1.2×

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 7 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: 77.2% accurate, 0.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{-0.25 \cdot \left(\frac{h}{g} \cdot h\right)}}{\sqrt[3]{a}} + \sqrt[3]{\frac{-g}{a}}\\


\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.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. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \color{blue}{\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. rem-square-sqrtN/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\color{blue}{\sqrt{g \cdot g - h \cdot h} \cdot \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)} \]
      3. lift-sqrt.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\color{blue}{\sqrt{g \cdot g - h \cdot h}} \cdot \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)} \]
      4. lift-sqrt.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{g \cdot g - h \cdot h} \cdot \color{blue}{\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)} \]
      5. sqrt-prodN/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \color{blue}{\sqrt{\sqrt{g \cdot g - h \cdot h}} \cdot \sqrt{\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)} \]
      6. lower-*.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \color{blue}{\sqrt{\sqrt{g \cdot g - h \cdot h}} \cdot \sqrt{\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)} \]
      7. lower-sqrt.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \color{blue}{\sqrt{\sqrt{g \cdot g - h \cdot h}}} \cdot \sqrt{\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)} \]
      8. lift--.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{\color{blue}{g \cdot g - h \cdot h}}} \cdot \sqrt{\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)} \]
      9. lift-*.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{\color{blue}{g \cdot g} - h \cdot h}} \cdot \sqrt{\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)} \]
      10. lift-*.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{g \cdot g - \color{blue}{h \cdot h}}} \cdot \sqrt{\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)} \]
      11. difference-of-squaresN/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{\color{blue}{\left(g + h\right) \cdot \left(g - h\right)}}} \cdot \sqrt{\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)} \]
      12. *-commutativeN/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{\color{blue}{\left(g - h\right) \cdot \left(g + h\right)}}} \cdot \sqrt{\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)} \]
      13. lower-*.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{\color{blue}{\left(g - h\right) \cdot \left(g + h\right)}}} \cdot \sqrt{\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)} \]
      14. lower--.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{\color{blue}{\left(g - h\right)} \cdot \left(g + h\right)}} \cdot \sqrt{\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)} \]
      15. +-commutativeN/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{\left(g - h\right) \cdot \color{blue}{\left(h + g\right)}}} \cdot \sqrt{\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)} \]
      16. lower-+.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{\left(g - h\right) \cdot \color{blue}{\left(h + g\right)}}} \cdot \sqrt{\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)} \]
      17. lower-sqrt.f643.5

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{\left(g - h\right) \cdot \left(h + g\right)}} \cdot \color{blue}{\sqrt{\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)} \]
      18. lift--.f64N/A

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{\left(g - h\right) \cdot \left(h + g\right)}} \cdot \sqrt{\sqrt{\color{blue}{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)} \]
    4. Applied rewrites3.5%

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{\sqrt{\left(g - h\right) \cdot \left(h + g\right)}} \cdot \sqrt{\sqrt{\left(g - h\right) \cdot \left(h + g\right)}}\right)\right)}^{\frac{1}{3}}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \left(-g\right)\right)} \]
    9. Applied rewrites34.7%

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

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

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

    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 51.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(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\color{blue}{\sqrt[3]{\frac{-1}{2}}} \cdot \sqrt[3]{\frac{1}{2}}\right) + \sqrt[3]{\frac{-g}{a}} \]
      10. lower-cbrt.f6479.7

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

      \[\leadsto \color{blue}{\sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right)} + \sqrt[3]{\frac{-g}{a}} \]
    9. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \color{blue}{\sqrt[3]{\frac{-g}{a}} + \sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right)} \]
    10. Applied rewrites79.7%

      \[\leadsto \color{blue}{\sqrt[3]{\frac{-g}{a}} + \sqrt[3]{-0.25 \cdot \left(\frac{h}{g} \cdot \frac{h}{a}\right)}} \]
    11. Step-by-step derivation
      1. Applied rewrites79.8%

        \[\leadsto \sqrt[3]{\frac{-g}{a}} + \frac{\sqrt[3]{\left(\frac{h}{g} \cdot h\right) \cdot -0.25}}{\color{blue}{\sqrt[3]{a}}} \]
    12. Recombined 2 regimes into one program.
    13. Final simplification80.1%

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

    Alternative 2: 77.2% accurate, 0.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\left(g - h\right) \cdot \left(h + g\right)}\\ t_1 := \sqrt[3]{a \cdot 2}\\ t_2 := \sqrt{g \cdot g - h \cdot h}\\ \mathbf{if}\;\sqrt[3]{\frac{-1}{a \cdot 2} \cdot \left(t\_2 + g\right)} + \sqrt[3]{\left(t\_2 - g\right) \cdot \frac{1}{a \cdot 2}} \leq -\infty:\\ \;\;\;\;\frac{\sqrt[3]{\left(-g\right) - t\_0}}{t\_1} + \frac{{\left(t\_0 - g\right)}^{0.3333333333333333}}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{-0.25 \cdot \left(\frac{h}{g} \cdot h\right)}}{\sqrt[3]{a}} + \sqrt[3]{\frac{-g}{a}}\\ \end{array} \end{array} \]
    (FPCore (g h a)
     :precision binary64
     (let* ((t_0 (sqrt (* (- g h) (+ h g))))
            (t_1 (cbrt (* a 2.0)))
            (t_2 (sqrt (- (* g g) (* h h)))))
       (if (<=
            (+
             (cbrt (* (/ -1.0 (* a 2.0)) (+ t_2 g)))
             (cbrt (* (- t_2 g) (/ 1.0 (* a 2.0)))))
            (- INFINITY))
         (+
          (/ (cbrt (- (- g) t_0)) t_1)
          (/ (pow (- t_0 g) 0.3333333333333333) t_1))
         (+ (/ (cbrt (* -0.25 (* (/ h g) h))) (cbrt a)) (cbrt (/ (- g) a))))))
    double code(double g, double h, double a) {
    	double t_0 = sqrt(((g - h) * (h + g)));
    	double t_1 = cbrt((a * 2.0));
    	double t_2 = sqrt(((g * g) - (h * h)));
    	double tmp;
    	if ((cbrt(((-1.0 / (a * 2.0)) * (t_2 + g))) + cbrt(((t_2 - g) * (1.0 / (a * 2.0))))) <= -((double) INFINITY)) {
    		tmp = (cbrt((-g - t_0)) / t_1) + (pow((t_0 - g), 0.3333333333333333) / t_1);
    	} else {
    		tmp = (cbrt((-0.25 * ((h / g) * h))) / cbrt(a)) + cbrt((-g / a));
    	}
    	return tmp;
    }
    
    public static double code(double g, double h, double a) {
    	double t_0 = Math.sqrt(((g - h) * (h + g)));
    	double t_1 = Math.cbrt((a * 2.0));
    	double t_2 = Math.sqrt(((g * g) - (h * h)));
    	double tmp;
    	if ((Math.cbrt(((-1.0 / (a * 2.0)) * (t_2 + g))) + Math.cbrt(((t_2 - g) * (1.0 / (a * 2.0))))) <= -Double.POSITIVE_INFINITY) {
    		tmp = (Math.cbrt((-g - t_0)) / t_1) + (Math.pow((t_0 - g), 0.3333333333333333) / t_1);
    	} else {
    		tmp = (Math.cbrt((-0.25 * ((h / g) * h))) / Math.cbrt(a)) + Math.cbrt((-g / a));
    	}
    	return tmp;
    }
    
    function code(g, h, a)
    	t_0 = sqrt(Float64(Float64(g - h) * Float64(h + g)))
    	t_1 = cbrt(Float64(a * 2.0))
    	t_2 = sqrt(Float64(Float64(g * g) - Float64(h * h)))
    	tmp = 0.0
    	if (Float64(cbrt(Float64(Float64(-1.0 / Float64(a * 2.0)) * Float64(t_2 + g))) + cbrt(Float64(Float64(t_2 - g) * Float64(1.0 / Float64(a * 2.0))))) <= Float64(-Inf))
    		tmp = Float64(Float64(cbrt(Float64(Float64(-g) - t_0)) / t_1) + Float64((Float64(t_0 - g) ^ 0.3333333333333333) / t_1));
    	else
    		tmp = Float64(Float64(cbrt(Float64(-0.25 * Float64(Float64(h / g) * h))) / cbrt(a)) + cbrt(Float64(Float64(-g) / a)));
    	end
    	return tmp
    end
    
    code[g_, h_, a_] := Block[{t$95$0 = N[Sqrt[N[(N[(g - h), $MachinePrecision] * N[(h + g), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(a * 2.0), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(-1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(t$95$2 - g), $MachinePrecision] * N[(1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(N[(N[Power[N[((-g) - t$95$0), $MachinePrecision], 1/3], $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[Power[N[(t$95$0 - g), $MachinePrecision], 0.3333333333333333], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(-0.25 * N[(N[(h / g), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \sqrt{\left(g - h\right) \cdot \left(h + g\right)}\\
    t_1 := \sqrt[3]{a \cdot 2}\\
    t_2 := \sqrt{g \cdot g - h \cdot h}\\
    \mathbf{if}\;\sqrt[3]{\frac{-1}{a \cdot 2} \cdot \left(t\_2 + g\right)} + \sqrt[3]{\left(t\_2 - g\right) \cdot \frac{1}{a \cdot 2}} \leq -\infty:\\
    \;\;\;\;\frac{\sqrt[3]{\left(-g\right) - t\_0}}{t\_1} + \frac{{\left(t\_0 - g\right)}^{0.3333333333333333}}{t\_1}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\sqrt[3]{-0.25 \cdot \left(\frac{h}{g} \cdot h\right)}}{\sqrt[3]{a}} + \sqrt[3]{\frac{-g}{a}}\\
    
    
    \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.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. Step-by-step derivation
        1. lift-cbrt.f64N/A

          \[\leadsto \color{blue}{\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. lift-*.f64N/A

          \[\leadsto \sqrt[3]{\color{blue}{\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)} \]
        3. lift-/.f64N/A

          \[\leadsto \sqrt[3]{\color{blue}{\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)} \]
        4. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{{\left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)}^{0.3333333333333333}}}{\sqrt[3]{a \cdot 2}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
      6. Applied rewrites33.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left(\sqrt{\left(h + g\right) \cdot \left(g - h\right)} - g\right)}^{0.3333333333333333}}{\sqrt[3]{a \cdot 2}} + \color{blue}{\frac{\sqrt[3]{\left(-g\right) - \sqrt{\left(h + g\right) \cdot \left(g - h\right)}}}{\sqrt[3]{a \cdot 2}}} \]

      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 51.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(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
      4. Step-by-step derivation
        1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\color{blue}{\sqrt[3]{\frac{-1}{2}}} \cdot \sqrt[3]{\frac{1}{2}}\right) + \sqrt[3]{\frac{-g}{a}} \]
        10. lower-cbrt.f6479.7

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

        \[\leadsto \color{blue}{\sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right)} + \sqrt[3]{\frac{-g}{a}} \]
      9. Step-by-step derivation
        1. lift-+.f64N/A

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

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

          \[\leadsto \color{blue}{\sqrt[3]{\frac{-g}{a}} + \sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right)} \]
      10. Applied rewrites79.7%

        \[\leadsto \color{blue}{\sqrt[3]{\frac{-g}{a}} + \sqrt[3]{-0.25 \cdot \left(\frac{h}{g} \cdot \frac{h}{a}\right)}} \]
      11. Step-by-step derivation
        1. Applied rewrites79.8%

          \[\leadsto \sqrt[3]{\frac{-g}{a}} + \frac{\sqrt[3]{\left(\frac{h}{g} \cdot h\right) \cdot -0.25}}{\color{blue}{\sqrt[3]{a}}} \]
      12. Recombined 2 regimes into one program.
      13. Final simplification80.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt[3]{\frac{-1}{a \cdot 2} \cdot \left(\sqrt{g \cdot g - h \cdot h} + g\right)} + \sqrt[3]{\left(\sqrt{g \cdot g - h \cdot h} - g\right) \cdot \frac{1}{a \cdot 2}} \leq -\infty:\\ \;\;\;\;\frac{\sqrt[3]{\left(-g\right) - \sqrt{\left(g - h\right) \cdot \left(h + g\right)}}}{\sqrt[3]{a \cdot 2}} + \frac{{\left(\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g\right)}^{0.3333333333333333}}{\sqrt[3]{a \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{-0.25 \cdot \left(\frac{h}{g} \cdot h\right)}}{\sqrt[3]{a}} + \sqrt[3]{\frac{-g}{a}}\\ \end{array} \]
      14. Add Preprocessing

      Alternative 3: 75.5% accurate, 0.9× speedup?

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

        \[\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(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
      4. Step-by-step derivation
        1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\color{blue}{\sqrt[3]{\frac{-1}{2}}} \cdot \sqrt[3]{\frac{1}{2}}\right) + \sqrt[3]{\frac{-g}{a}} \]
        10. lower-cbrt.f6477.9

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

        \[\leadsto \color{blue}{\sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right)} + \sqrt[3]{\frac{-g}{a}} \]
      9. Step-by-step derivation
        1. lift-+.f64N/A

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

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

          \[\leadsto \color{blue}{\sqrt[3]{\frac{-g}{a}} + \sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right)} \]
      10. Applied rewrites77.9%

        \[\leadsto \color{blue}{\sqrt[3]{\frac{-g}{a}} + \sqrt[3]{-0.25 \cdot \left(\frac{h}{g} \cdot \frac{h}{a}\right)}} \]
      11. Step-by-step derivation
        1. Applied rewrites78.0%

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

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

        Alternative 4: 75.1% accurate, 1.2× speedup?

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

          \[\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(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
        4. Step-by-step derivation
          1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\color{blue}{\sqrt[3]{\frac{-1}{2}}} \cdot \sqrt[3]{\frac{1}{2}}\right) + \sqrt[3]{\frac{-g}{a}} \]
          10. lower-cbrt.f6477.9

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

          \[\leadsto \color{blue}{\sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right)} + \sqrt[3]{\frac{-g}{a}} \]
        9. Step-by-step derivation
          1. lift-+.f64N/A

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

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

            \[\leadsto \color{blue}{\sqrt[3]{\frac{-g}{a}} + \sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right)} \]
        10. Applied rewrites77.9%

          \[\leadsto \color{blue}{\sqrt[3]{\frac{-g}{a}} + \sqrt[3]{-0.25 \cdot \left(\frac{h}{g} \cdot \frac{h}{a}\right)}} \]
        11. Step-by-step derivation
          1. Applied rewrites78.0%

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

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

          Alternative 5: 75.4% accurate, 1.2× speedup?

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

            \[\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(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
          4. Step-by-step derivation
            1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\color{blue}{\sqrt[3]{\frac{-1}{2}}} \cdot \sqrt[3]{\frac{1}{2}}\right) + \sqrt[3]{\frac{-g}{a}} \]
            10. lower-cbrt.f6477.9

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

            \[\leadsto \color{blue}{\sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right)} + \sqrt[3]{\frac{-g}{a}} \]
          9. Step-by-step derivation
            1. lift-+.f64N/A

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

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

              \[\leadsto \color{blue}{\sqrt[3]{\frac{-g}{a}} + \sqrt[3]{\frac{h}{a} \cdot \frac{h}{g}} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right)} \]
          10. Applied rewrites77.9%

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

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

          Alternative 6: 15.3% accurate, 1.2× speedup?

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

            \[\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(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
          4. Step-by-step derivation
            1. associate-*r/N/A

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

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

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

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

            \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{\frac{-g}{a}}} \]
          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{-g}{a}} \]
          7. Step-by-step derivation
            1. lower-*.f6415.7

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

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

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

          Alternative 7: 2.9% accurate, 302.0× speedup?

          \[\begin{array}{l} \\ 0 \end{array} \]
          (FPCore (g h a) :precision binary64 0.0)
          double code(double g, double h, double a) {
          	return 0.0;
          }
          
          real(8) function code(g, h, a)
              real(8), intent (in) :: g
              real(8), intent (in) :: h
              real(8), intent (in) :: a
              code = 0.0d0
          end function
          
          public static double code(double g, double h, double a) {
          	return 0.0;
          }
          
          def code(g, h, a):
          	return 0.0
          
          function code(g, h, a)
          	return 0.0
          end
          
          function tmp = code(g, h, a)
          	tmp = 0.0;
          end
          
          code[g_, h_, a_] := 0.0
          
          \begin{array}{l}
          
          \\
          0
          \end{array}
          
          Derivation
          1. Initial program 50.3%

            \[\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. Step-by-step derivation
            1. lift-cbrt.f64N/A

              \[\leadsto \color{blue}{\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. lift-*.f64N/A

              \[\leadsto \sqrt[3]{\color{blue}{\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)} \]
            3. lift-/.f64N/A

              \[\leadsto \sqrt[3]{\color{blue}{\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)} \]
            4. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto -\sqrt[3]{\frac{g \cdot \left(\color{blue}{\sqrt{-1} \cdot \sqrt{-1}} + 1\right)}{a}} \cdot \frac{1}{\sqrt[3]{2}} \]
            9. rem-square-sqrtN/A

              \[\leadsto -\sqrt[3]{\frac{g \cdot \left(\color{blue}{-1} + 1\right)}{a}} \cdot \frac{1}{\sqrt[3]{2}} \]
            10. metadata-evalN/A

              \[\leadsto -\sqrt[3]{\frac{g \cdot \color{blue}{0}}{a}} \cdot \frac{1}{\sqrt[3]{2}} \]
            11. lower-/.f64N/A

              \[\leadsto -\sqrt[3]{\frac{g \cdot 0}{a}} \cdot \color{blue}{\frac{1}{\sqrt[3]{2}}} \]
            12. lower-cbrt.f643.0

              \[\leadsto -\sqrt[3]{\frac{g \cdot 0}{a}} \cdot \frac{1}{\color{blue}{\sqrt[3]{2}}} \]
          7. Applied rewrites3.0%

            \[\leadsto \color{blue}{-\sqrt[3]{\frac{g \cdot 0}{a}} \cdot \frac{1}{\sqrt[3]{2}}} \]
          8. Step-by-step derivation
            1. Applied rewrites3.0%

              \[\leadsto \color{blue}{0} \]
            2. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2024263 
            (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))))))))