2-ancestry mixing, positive discriminant

Percentage Accurate: 43.7% → 95.6%
Time: 16.0s
Alternatives: 7
Speedup: 2.6×

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.7% 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: 95.6% accurate, 1.4× speedup?

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

\\
\frac{\sqrt[3]{g \cdot -2}}{\sqrt[3]{a \cdot 2}}
\end{array}
Derivation
  1. Initial program 44.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) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
  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) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{\mathsf{neg}\left(\frac{g}{a}\right)}} \]
    2. distribute-neg-frac2N/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]{\color{blue}{\frac{g}{\mathsf{neg}\left(a\right)}}} \]
    3. lower-/.f64N/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]{\color{blue}{\frac{g}{\mathsf{neg}\left(a\right)}}} \]
    4. lower-neg.f6429.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{g}{\color{blue}{-a}}} \]
  5. Simplified29.5%

    \[\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{g}{a}} \cdot \sqrt[3]{-1}} \]
  7. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

      \[\leadsto \sqrt[3]{-1} \cdot \color{blue}{\sqrt[3]{\frac{g}{a}}} \]
    5. lower-/.f6478.6

      \[\leadsto \sqrt[3]{-1} \cdot \sqrt[3]{\color{blue}{\frac{g}{a}}} \]
  8. Simplified78.6%

    \[\leadsto \color{blue}{\sqrt[3]{-1} \cdot \sqrt[3]{\frac{g}{a}}} \]
  9. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \sqrt[3]{-1} \cdot \sqrt[3]{\color{blue}{\frac{g}{a}}} \]
    2. cbrt-unprodN/A

      \[\leadsto \color{blue}{\sqrt[3]{-1 \cdot \frac{g}{a}}} \]
    3. neg-mul-1N/A

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

      \[\leadsto \sqrt[3]{\mathsf{neg}\left(\color{blue}{\frac{g}{a}}\right)} \]
    5. distribute-frac-negN/A

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\sqrt[3]{\mathsf{neg}\left(g\right)}\right)}{\mathsf{neg}\left(\sqrt[3]{a}\right)}} \]
    11. div-invN/A

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(\sqrt[3]{\mathsf{neg}\left(g\right)}\right)\right) \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(\sqrt[3]{a}\right)}} \]
    15. lower-neg.f6496.8

      \[\leadsto \left(-\sqrt[3]{-g}\right) \cdot \frac{1}{\color{blue}{-\sqrt[3]{a}}} \]
  10. Applied egg-rr96.8%

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

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

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(\sqrt[3]{\mathsf{neg}\left(g\right)}\right)\right) \cdot \frac{1}{\color{blue}{\mathsf{neg}\left(\sqrt[3]{a}\right)}} \]
    6. un-div-invN/A

      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\sqrt[3]{\mathsf{neg}\left(g\right)}\right)}{\mathsf{neg}\left(\sqrt[3]{a}\right)}} \]
    7. clear-numN/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{neg}\left(\sqrt[3]{a}\right)}{\mathsf{neg}\left(\sqrt[3]{\mathsf{neg}\left(g\right)}\right)}}} \]
    8. metadata-evalN/A

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt[3]{1}}{\sqrt[3]{\frac{a}{\color{blue}{\mathsf{neg}\left(g\right)}}}} \]
    16. distribute-neg-frac2N/A

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

      \[\leadsto \frac{\sqrt[3]{1}}{\sqrt[3]{\mathsf{neg}\left(\color{blue}{\frac{a}{g}}\right)}} \]
    18. neg-mul-1N/A

      \[\leadsto \frac{\sqrt[3]{1}}{\sqrt[3]{\color{blue}{-1 \cdot \frac{a}{g}}}} \]
    19. metadata-evalN/A

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

      \[\leadsto \frac{\sqrt[3]{1}}{\sqrt[3]{\frac{2}{-2} \cdot \color{blue}{\frac{a}{g}}}} \]
    21. times-fracN/A

      \[\leadsto \frac{\sqrt[3]{1}}{\sqrt[3]{\color{blue}{\frac{2 \cdot a}{-2 \cdot g}}}} \]
    22. lift-*.f64N/A

      \[\leadsto \frac{\sqrt[3]{1}}{\sqrt[3]{\frac{\color{blue}{2 \cdot a}}{-2 \cdot g}}} \]
    23. *-commutativeN/A

      \[\leadsto \frac{\sqrt[3]{1}}{\sqrt[3]{\frac{2 \cdot a}{\color{blue}{g \cdot -2}}}} \]
    24. lift-*.f64N/A

      \[\leadsto \frac{\sqrt[3]{1}}{\sqrt[3]{\frac{2 \cdot a}{\color{blue}{g \cdot -2}}}} \]
    25. *-lft-identityN/A

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

    \[\leadsto \color{blue}{\frac{\sqrt[3]{g \cdot -2}}{\sqrt[3]{a \cdot 2}}} \]
  13. Add Preprocessing

Alternative 2: 81.8% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{1}{a \cdot 2} \leq 5 \cdot 10^{+37}:\\ \;\;\;\;-\sqrt[3]{\frac{\frac{1}{a}}{\frac{1}{g}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{-g} \cdot {a}^{-0.3333333333333333}\\ \end{array} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (if (<= (/ 1.0 (* a 2.0)) 5e+37)
   (- (cbrt (/ (/ 1.0 a) (/ 1.0 g))))
   (* (cbrt (- g)) (pow a -0.3333333333333333))))
double code(double g, double h, double a) {
	double tmp;
	if ((1.0 / (a * 2.0)) <= 5e+37) {
		tmp = -cbrt(((1.0 / a) / (1.0 / g)));
	} else {
		tmp = cbrt(-g) * pow(a, -0.3333333333333333);
	}
	return tmp;
}
public static double code(double g, double h, double a) {
	double tmp;
	if ((1.0 / (a * 2.0)) <= 5e+37) {
		tmp = -Math.cbrt(((1.0 / a) / (1.0 / g)));
	} else {
		tmp = Math.cbrt(-g) * Math.pow(a, -0.3333333333333333);
	}
	return tmp;
}
function code(g, h, a)
	tmp = 0.0
	if (Float64(1.0 / Float64(a * 2.0)) <= 5e+37)
		tmp = Float64(-cbrt(Float64(Float64(1.0 / a) / Float64(1.0 / g))));
	else
		tmp = Float64(cbrt(Float64(-g)) * (a ^ -0.3333333333333333));
	end
	return tmp
end
code[g_, h_, a_] := If[LessEqual[N[(1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], 5e+37], (-N[Power[N[(N[(1.0 / a), $MachinePrecision] / N[(1.0 / g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), N[(N[Power[(-g), 1/3], $MachinePrecision] * N[Power[a, -0.3333333333333333], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{a \cdot 2} \leq 5 \cdot 10^{+37}:\\
\;\;\;\;-\sqrt[3]{\frac{\frac{1}{a}}{\frac{1}{g}}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{-g} \cdot {a}^{-0.3333333333333333}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) < 4.99999999999999989e37

    1. Initial program 43.6%

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

        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\color{blue}{{h}^{2} \cdot \frac{-1}{2}}}{g}} + \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. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\sqrt[3]{\color{blue}{\frac{g}{a}}} \]
    11. Simplified82.2%

      \[\leadsto \color{blue}{-\sqrt[3]{\frac{g}{a}}} \]
    12. Step-by-step derivation
      1. clear-numN/A

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

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

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

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

        \[\leadsto \mathsf{neg}\left(\sqrt[3]{\frac{\color{blue}{\frac{1}{a}}}{\frac{1}{g}}}\right) \]
      6. lower-/.f6482.3

        \[\leadsto -\sqrt[3]{\frac{\frac{1}{a}}{\color{blue}{\frac{1}{g}}}} \]
    13. Applied egg-rr82.3%

      \[\leadsto -\sqrt[3]{\color{blue}{\frac{\frac{1}{a}}{\frac{1}{g}}}} \]

    if 4.99999999999999989e37 < (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 47.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]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
    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) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{\mathsf{neg}\left(\frac{g}{a}\right)}} \]
      2. distribute-neg-frac2N/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]{\color{blue}{\frac{g}{\mathsf{neg}\left(a\right)}}} \]
      3. lower-/.f64N/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]{\color{blue}{\frac{g}{\mathsf{neg}\left(a\right)}}} \]
      4. lower-neg.f6434.1

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

      \[\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{g}{a}} \cdot \sqrt[3]{-1}} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \sqrt[3]{-1} \cdot \color{blue}{\sqrt[3]{\frac{g}{a}}} \]
      5. lower-/.f6464.5

        \[\leadsto \sqrt[3]{-1} \cdot \sqrt[3]{\color{blue}{\frac{g}{a}}} \]
    8. Simplified64.5%

      \[\leadsto \color{blue}{\sqrt[3]{-1} \cdot \sqrt[3]{\frac{g}{a}}} \]
    9. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \sqrt[3]{-1} \cdot \sqrt[3]{\color{blue}{\frac{g}{a}}} \]
      2. cbrt-unprodN/A

        \[\leadsto \color{blue}{\sqrt[3]{-1 \cdot \frac{g}{a}}} \]
      3. neg-mul-1N/A

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

        \[\leadsto \sqrt[3]{\mathsf{neg}\left(\color{blue}{\frac{g}{a}}\right)} \]
      5. distribute-frac-negN/A

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

        \[\leadsto \sqrt[3]{\frac{\color{blue}{\mathsf{neg}\left(g\right)}}{a}} \]
      7. clear-numN/A

        \[\leadsto \sqrt[3]{\color{blue}{\frac{1}{\frac{a}{\mathsf{neg}\left(g\right)}}}} \]
      8. associate-/r/N/A

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

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

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

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

        \[\leadsto \sqrt[3]{\frac{1}{a}} \cdot \color{blue}{\sqrt[3]{\mathsf{neg}\left(g\right)}} \]
      13. lower-*.f6494.1

        \[\leadsto \color{blue}{\sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{-g}} \]
      14. lift-cbrt.f64N/A

        \[\leadsto \color{blue}{\sqrt[3]{\frac{1}{a}}} \cdot \sqrt[3]{\mathsf{neg}\left(g\right)} \]
      15. pow1/3N/A

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

        \[\leadsto {\color{blue}{\left(\frac{1}{a}\right)}}^{\frac{1}{3}} \cdot \sqrt[3]{\mathsf{neg}\left(g\right)} \]
      17. inv-powN/A

        \[\leadsto {\color{blue}{\left({a}^{-1}\right)}}^{\frac{1}{3}} \cdot \sqrt[3]{\mathsf{neg}\left(g\right)} \]
      18. pow-powN/A

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

        \[\leadsto \color{blue}{{a}^{\left(-1 \cdot \frac{1}{3}\right)}} \cdot \sqrt[3]{\mathsf{neg}\left(g\right)} \]
      20. metadata-eval87.7

        \[\leadsto {a}^{\color{blue}{-0.3333333333333333}} \cdot \sqrt[3]{-g} \]
    10. Applied egg-rr87.7%

      \[\leadsto \color{blue}{{a}^{-0.3333333333333333} \cdot \sqrt[3]{-g}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{a \cdot 2} \leq 5 \cdot 10^{+37}:\\ \;\;\;\;-\sqrt[3]{\frac{\frac{1}{a}}{\frac{1}{g}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{-g} \cdot {a}^{-0.3333333333333333}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 95.7% accurate, 1.4× speedup?

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

\\
\sqrt[3]{g} \cdot \frac{-1}{\sqrt[3]{a}}
\end{array}
Derivation
  1. Initial program 44.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) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
  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) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{\mathsf{neg}\left(\frac{g}{a}\right)}} \]
    2. distribute-neg-frac2N/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]{\color{blue}{\frac{g}{\mathsf{neg}\left(a\right)}}} \]
    3. lower-/.f64N/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]{\color{blue}{\frac{g}{\mathsf{neg}\left(a\right)}}} \]
    4. lower-neg.f6429.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{g}{\color{blue}{-a}}} \]
  5. Simplified29.5%

    \[\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{g}{a}} \cdot \sqrt[3]{-1}} \]
  7. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

      \[\leadsto \sqrt[3]{-1} \cdot \color{blue}{\sqrt[3]{\frac{g}{a}}} \]
    5. lower-/.f6478.6

      \[\leadsto \sqrt[3]{-1} \cdot \sqrt[3]{\color{blue}{\frac{g}{a}}} \]
  8. Simplified78.6%

    \[\leadsto \color{blue}{\sqrt[3]{-1} \cdot \sqrt[3]{\frac{g}{a}}} \]
  9. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \sqrt[3]{-1} \cdot \sqrt[3]{\color{blue}{\frac{g}{a}}} \]
    2. cbrt-unprodN/A

      \[\leadsto \color{blue}{\sqrt[3]{-1 \cdot \frac{g}{a}}} \]
    3. neg-mul-1N/A

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

      \[\leadsto \sqrt[3]{\mathsf{neg}\left(\color{blue}{\frac{g}{a}}\right)} \]
    5. distribute-frac-negN/A

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\sqrt[3]{\mathsf{neg}\left(g\right)}\right)}{\mathsf{neg}\left(\sqrt[3]{a}\right)}} \]
    11. div-invN/A

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(\sqrt[3]{\mathsf{neg}\left(g\right)}\right)\right) \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(\sqrt[3]{a}\right)}} \]
    15. lower-neg.f6496.8

      \[\leadsto \left(-\sqrt[3]{-g}\right) \cdot \frac{1}{\color{blue}{-\sqrt[3]{a}}} \]
  10. Applied egg-rr96.8%

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

    \[\leadsto \color{blue}{\sqrt[3]{g}} \cdot \frac{1}{\mathsf{neg}\left(\sqrt[3]{a}\right)} \]
  12. Step-by-step derivation
    1. lower-cbrt.f6496.8

      \[\leadsto \color{blue}{\sqrt[3]{g}} \cdot \frac{1}{-\sqrt[3]{a}} \]
  13. Simplified96.8%

    \[\leadsto \color{blue}{\sqrt[3]{g}} \cdot \frac{1}{-\sqrt[3]{a}} \]
  14. Final simplification96.8%

    \[\leadsto \sqrt[3]{g} \cdot \frac{-1}{\sqrt[3]{a}} \]
  15. Add Preprocessing

Alternative 4: 95.7% accurate, 1.4× speedup?

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

\\
\frac{\sqrt[3]{-g}}{\sqrt[3]{a}}
\end{array}
Derivation
  1. Initial program 44.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) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
  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) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{\mathsf{neg}\left(\frac{g}{a}\right)}} \]
    2. distribute-neg-frac2N/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]{\color{blue}{\frac{g}{\mathsf{neg}\left(a\right)}}} \]
    3. lower-/.f64N/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]{\color{blue}{\frac{g}{\mathsf{neg}\left(a\right)}}} \]
    4. lower-neg.f6429.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{g}{\color{blue}{-a}}} \]
  5. Simplified29.5%

    \[\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{g}{a}} \cdot \sqrt[3]{-1}} \]
  7. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

      \[\leadsto \sqrt[3]{-1} \cdot \color{blue}{\sqrt[3]{\frac{g}{a}}} \]
    5. lower-/.f6478.6

      \[\leadsto \sqrt[3]{-1} \cdot \sqrt[3]{\color{blue}{\frac{g}{a}}} \]
  8. Simplified78.6%

    \[\leadsto \color{blue}{\sqrt[3]{-1} \cdot \sqrt[3]{\frac{g}{a}}} \]
  9. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \sqrt[3]{-1} \cdot \sqrt[3]{\color{blue}{\frac{g}{a}}} \]
    2. cbrt-unprodN/A

      \[\leadsto \color{blue}{\sqrt[3]{-1 \cdot \frac{g}{a}}} \]
    3. neg-mul-1N/A

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

      \[\leadsto \sqrt[3]{\mathsf{neg}\left(\color{blue}{\frac{g}{a}}\right)} \]
    5. distribute-frac-negN/A

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

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

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

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

      \[\leadsto \frac{\sqrt[3]{\mathsf{neg}\left(g\right)}}{\color{blue}{\sqrt[3]{a}}} \]
    10. lift-/.f6496.8

      \[\leadsto \color{blue}{\frac{\sqrt[3]{-g}}{\sqrt[3]{a}}} \]
  10. Applied egg-rr96.8%

    \[\leadsto \color{blue}{\frac{\sqrt[3]{-g}}{\sqrt[3]{a}}} \]
  11. Add Preprocessing

Alternative 5: 73.9% accurate, 2.2× speedup?

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

\\
-\sqrt[3]{\frac{\frac{1}{a}}{\frac{1}{g}}}
\end{array}
Derivation
  1. Initial program 44.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 \color{blue}{\left(\frac{-1}{2} \cdot \frac{{h}^{2}}{g}\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. 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(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\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(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
    3. *-commutativeN/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\color{blue}{{h}^{2} \cdot \frac{-1}{2}}}{g}} + \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. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\sqrt[3]{\color{blue}{\frac{g}{a}}} \]
  11. Simplified78.6%

    \[\leadsto \color{blue}{-\sqrt[3]{\frac{g}{a}}} \]
  12. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

      \[\leadsto \mathsf{neg}\left(\sqrt[3]{\frac{\color{blue}{\frac{1}{a}}}{\frac{1}{g}}}\right) \]
    6. lower-/.f6478.7

      \[\leadsto -\sqrt[3]{\frac{\frac{1}{a}}{\color{blue}{\frac{1}{g}}}} \]
  13. Applied egg-rr78.7%

    \[\leadsto -\sqrt[3]{\color{blue}{\frac{\frac{1}{a}}{\frac{1}{g}}}} \]
  14. Add Preprocessing

Alternative 6: 73.9% accurate, 2.5× speedup?

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

\\
-\sqrt[3]{g \cdot \frac{1}{a}}
\end{array}
Derivation
  1. Initial program 44.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 \color{blue}{\left(\frac{-1}{2} \cdot \frac{{h}^{2}}{g}\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. 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(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\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(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
    3. *-commutativeN/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\color{blue}{{h}^{2} \cdot \frac{-1}{2}}}{g}} + \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. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\sqrt[3]{\color{blue}{\frac{g}{a}}} \]
  11. Simplified78.6%

    \[\leadsto \color{blue}{-\sqrt[3]{\frac{g}{a}}} \]
  12. Step-by-step derivation
    1. clear-numN/A

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

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

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

      \[\leadsto -\sqrt[3]{\color{blue}{\frac{1}{a}} \cdot g} \]
  13. Applied egg-rr78.7%

    \[\leadsto -\sqrt[3]{\color{blue}{\frac{1}{a} \cdot g}} \]
  14. Final simplification78.7%

    \[\leadsto -\sqrt[3]{g \cdot \frac{1}{a}} \]
  15. Add Preprocessing

Alternative 7: 73.9% accurate, 2.6× speedup?

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

\\
-\sqrt[3]{\frac{g}{a}}
\end{array}
Derivation
  1. Initial program 44.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 \color{blue}{\left(\frac{-1}{2} \cdot \frac{{h}^{2}}{g}\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. 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(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\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(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
    3. *-commutativeN/A

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \frac{\color{blue}{{h}^{2} \cdot \frac{-1}{2}}}{g}} + \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. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\sqrt[3]{\color{blue}{\frac{g}{a}}} \]
  11. Simplified78.6%

    \[\leadsto \color{blue}{-\sqrt[3]{\frac{g}{a}}} \]
  12. Add Preprocessing

Reproduce

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