2-ancestry mixing, positive discriminant

Percentage Accurate: 44.6% → 78.3%
Time: 12.8s
Alternatives: 5
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 5 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: 44.6% 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: 78.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\ t_1 := \sqrt{g \cdot g - h \cdot h}\\ t_2 := \sqrt[3]{\left(t\_1 - g\right) \cdot \frac{1}{a \cdot 2}}\\ t_3 := \sqrt[3]{\frac{-1}{a \cdot 2} \cdot \left(t\_1 + g\right)} + t\_2\\ \mathbf{if}\;t\_3 \leq -4 \cdot 10^{-103}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_3 \leq 0:\\ \;\;\;\;\frac{\left(\sqrt[3]{2} \cdot \sqrt[3]{-0.5}\right) \cdot \sqrt[3]{g}}{\sqrt[3]{a}} + t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (let* ((t_0 (+ (cbrt (* (* (/ h a) (/ h g)) -0.25)) (cbrt (/ (- g) a))))
        (t_1 (sqrt (- (* g g) (* h h))))
        (t_2 (cbrt (* (- t_1 g) (/ 1.0 (* a 2.0)))))
        (t_3 (+ (cbrt (* (/ -1.0 (* a 2.0)) (+ t_1 g))) t_2)))
   (if (<= t_3 -4e-103)
     t_0
     (if (<= t_3 0.0)
       (+ (/ (* (* (cbrt 2.0) (cbrt -0.5)) (cbrt g)) (cbrt a)) t_2)
       t_0))))
double code(double g, double h, double a) {
	double t_0 = cbrt((((h / a) * (h / g)) * -0.25)) + cbrt((-g / a));
	double t_1 = sqrt(((g * g) - (h * h)));
	double t_2 = cbrt(((t_1 - g) * (1.0 / (a * 2.0))));
	double t_3 = cbrt(((-1.0 / (a * 2.0)) * (t_1 + g))) + t_2;
	double tmp;
	if (t_3 <= -4e-103) {
		tmp = t_0;
	} else if (t_3 <= 0.0) {
		tmp = (((cbrt(2.0) * cbrt(-0.5)) * cbrt(g)) / cbrt(a)) + t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double g, double h, double a) {
	double t_0 = Math.cbrt((((h / a) * (h / g)) * -0.25)) + Math.cbrt((-g / a));
	double t_1 = Math.sqrt(((g * g) - (h * h)));
	double t_2 = Math.cbrt(((t_1 - g) * (1.0 / (a * 2.0))));
	double t_3 = Math.cbrt(((-1.0 / (a * 2.0)) * (t_1 + g))) + t_2;
	double tmp;
	if (t_3 <= -4e-103) {
		tmp = t_0;
	} else if (t_3 <= 0.0) {
		tmp = (((Math.cbrt(2.0) * Math.cbrt(-0.5)) * Math.cbrt(g)) / Math.cbrt(a)) + t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(g, h, a)
	t_0 = Float64(cbrt(Float64(Float64(Float64(h / a) * Float64(h / g)) * -0.25)) + cbrt(Float64(Float64(-g) / a)))
	t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h)))
	t_2 = cbrt(Float64(Float64(t_1 - g) * Float64(1.0 / Float64(a * 2.0))))
	t_3 = Float64(cbrt(Float64(Float64(-1.0 / Float64(a * 2.0)) * Float64(t_1 + g))) + t_2)
	tmp = 0.0
	if (t_3 <= -4e-103)
		tmp = t_0;
	elseif (t_3 <= 0.0)
		tmp = Float64(Float64(Float64(Float64(cbrt(2.0) * cbrt(-0.5)) * cbrt(g)) / cbrt(a)) + t_2);
	else
		tmp = t_0;
	end
	return tmp
end
code[g_, h_, a_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(N[(t$95$1 - g), $MachinePrecision] * N[(1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[N[(N[(-1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, -4e-103], t$95$0, If[LessEqual[t$95$3, 0.0], N[(N[(N[(N[(N[Power[2.0, 1/3], $MachinePrecision] * N[Power[-0.5, 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
t_2 := \sqrt[3]{\left(t\_1 - g\right) \cdot \frac{1}{a \cdot 2}}\\
t_3 := \sqrt[3]{\frac{-1}{a \cdot 2} \cdot \left(t\_1 + g\right)} + t\_2\\
\mathbf{if}\;t\_3 \leq -4 \cdot 10^{-103}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\frac{\left(\sqrt[3]{2} \cdot \sqrt[3]{-0.5}\right) \cdot \sqrt[3]{g}}{\sqrt[3]{a}} + t\_2\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\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))))))) < -3.99999999999999983e-103 or 0.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 44.2%

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

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-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.f6425.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 rewrites25.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.f6477.2

        \[\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.2%

      \[\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.2

        \[\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.2%

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

    if -3.99999999999999983e-103 < (+.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))))))) < 0.0

    1. Initial program 4.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-*.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{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}} \]
      2. lift--.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]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}} \]
      3. distribute-lft-out--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}{2 \cdot a} \cdot \left(-g\right) - \frac{1}{2 \cdot a} \cdot \sqrt{g \cdot g - h \cdot h}}} \]
      4. cancel-sign-sub-invN/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}{2 \cdot a} \cdot \left(-g\right) + \left(\mathsf{neg}\left(\frac{1}{2 \cdot a}\right)\right) \cdot \sqrt{g \cdot g - h \cdot h}}} \]
      5. lift-/.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]{\frac{1}{2 \cdot a} \cdot \left(-g\right) + \left(\mathsf{neg}\left(\color{blue}{\frac{1}{2 \cdot a}}\right)\right) \cdot \sqrt{g \cdot g - h \cdot h}} \]
      6. distribute-frac-neg2N/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{1}{2 \cdot a} \cdot \left(-g\right) + \color{blue}{\frac{1}{\mathsf{neg}\left(2 \cdot a\right)}} \cdot \sqrt{g \cdot g - h \cdot h}} \]
      7. lift-neg.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]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(\mathsf{neg}\left(g\right)\right)} + \frac{1}{\mathsf{neg}\left(2 \cdot a\right)} \cdot \sqrt{g \cdot g - h \cdot h}} \]
      8. distribute-rgt-neg-outN/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}{\left(\mathsf{neg}\left(\frac{1}{2 \cdot a} \cdot g\right)\right)} + \frac{1}{\mathsf{neg}\left(2 \cdot a\right)} \cdot \sqrt{g \cdot g - h \cdot h}} \]
      9. distribute-lft-neg-inN/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}{\left(\mathsf{neg}\left(\frac{1}{2 \cdot a}\right)\right) \cdot g} + \frac{1}{\mathsf{neg}\left(2 \cdot a\right)} \cdot \sqrt{g \cdot g - h \cdot h}} \]
      10. lift-/.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]{\left(\mathsf{neg}\left(\color{blue}{\frac{1}{2 \cdot a}}\right)\right) \cdot g + \frac{1}{\mathsf{neg}\left(2 \cdot a\right)} \cdot \sqrt{g \cdot g - h \cdot h}} \]
      11. distribute-frac-neg2N/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}{\mathsf{neg}\left(2 \cdot a\right)}} \cdot g + \frac{1}{\mathsf{neg}\left(2 \cdot a\right)} \cdot \sqrt{g \cdot g - h \cdot h}} \]
      12. lower-fma.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}{\mathsf{fma}\left(\frac{1}{\mathsf{neg}\left(2 \cdot a\right)}, g, \frac{1}{\mathsf{neg}\left(2 \cdot a\right)} \cdot \sqrt{g \cdot g - h \cdot h}\right)}} \]
    4. Applied rewrites4.2%

      \[\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}{\mathsf{fma}\left(-\frac{0.5}{a}, g, \left(-\frac{0.5}{a}\right) \cdot \sqrt{\left(g - h\right) \cdot \left(h + g\right)}\right)}} \]
    5. Applied rewrites27.5%

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

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

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

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

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

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

    \[\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 -4 \cdot 10^{-103}:\\ \;\;\;\;\sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\ \mathbf{elif}\;\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 0:\\ \;\;\;\;\frac{\left(\sqrt[3]{2} \cdot \sqrt[3]{-0.5}\right) \cdot \sqrt[3]{g}}{\sqrt[3]{a}} + \sqrt[3]{\left(\sqrt{g \cdot g - h \cdot h} - g\right) \cdot \frac{1}{a \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 78.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\ t_1 := \sqrt{g \cdot g - h \cdot h}\\ t_2 := \sqrt[3]{\left(t\_1 - g\right) \cdot \frac{1}{a \cdot 2}}\\ t_3 := \sqrt[3]{\frac{-1}{a \cdot 2} \cdot \left(t\_1 + g\right)} + t\_2\\ \mathbf{if}\;t\_3 \leq -1 \cdot 10^{-100}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_3 \leq 0:\\ \;\;\;\;\frac{\sqrt[3]{-g}}{\sqrt[3]{a}} + t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (let* ((t_0 (+ (cbrt (* (* (/ h a) (/ h g)) -0.25)) (cbrt (/ (- g) a))))
        (t_1 (sqrt (- (* g g) (* h h))))
        (t_2 (cbrt (* (- t_1 g) (/ 1.0 (* a 2.0)))))
        (t_3 (+ (cbrt (* (/ -1.0 (* a 2.0)) (+ t_1 g))) t_2)))
   (if (<= t_3 -1e-100)
     t_0
     (if (<= t_3 0.0) (+ (/ (cbrt (- g)) (cbrt a)) t_2) t_0))))
double code(double g, double h, double a) {
	double t_0 = cbrt((((h / a) * (h / g)) * -0.25)) + cbrt((-g / a));
	double t_1 = sqrt(((g * g) - (h * h)));
	double t_2 = cbrt(((t_1 - g) * (1.0 / (a * 2.0))));
	double t_3 = cbrt(((-1.0 / (a * 2.0)) * (t_1 + g))) + t_2;
	double tmp;
	if (t_3 <= -1e-100) {
		tmp = t_0;
	} else if (t_3 <= 0.0) {
		tmp = (cbrt(-g) / cbrt(a)) + t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double g, double h, double a) {
	double t_0 = Math.cbrt((((h / a) * (h / g)) * -0.25)) + Math.cbrt((-g / a));
	double t_1 = Math.sqrt(((g * g) - (h * h)));
	double t_2 = Math.cbrt(((t_1 - g) * (1.0 / (a * 2.0))));
	double t_3 = Math.cbrt(((-1.0 / (a * 2.0)) * (t_1 + g))) + t_2;
	double tmp;
	if (t_3 <= -1e-100) {
		tmp = t_0;
	} else if (t_3 <= 0.0) {
		tmp = (Math.cbrt(-g) / Math.cbrt(a)) + t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(g, h, a)
	t_0 = Float64(cbrt(Float64(Float64(Float64(h / a) * Float64(h / g)) * -0.25)) + cbrt(Float64(Float64(-g) / a)))
	t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h)))
	t_2 = cbrt(Float64(Float64(t_1 - g) * Float64(1.0 / Float64(a * 2.0))))
	t_3 = Float64(cbrt(Float64(Float64(-1.0 / Float64(a * 2.0)) * Float64(t_1 + g))) + t_2)
	tmp = 0.0
	if (t_3 <= -1e-100)
		tmp = t_0;
	elseif (t_3 <= 0.0)
		tmp = Float64(Float64(cbrt(Float64(-g)) / cbrt(a)) + t_2);
	else
		tmp = t_0;
	end
	return tmp
end
code[g_, h_, a_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(N[(t$95$1 - g), $MachinePrecision] * N[(1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[N[(N[(-1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, -1e-100], t$95$0, If[LessEqual[t$95$3, 0.0], N[(N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
t_2 := \sqrt[3]{\left(t\_1 - g\right) \cdot \frac{1}{a \cdot 2}}\\
t_3 := \sqrt[3]{\frac{-1}{a \cdot 2} \cdot \left(t\_1 + g\right)} + t\_2\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{-100}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\frac{\sqrt[3]{-g}}{\sqrt[3]{a}} + t\_2\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\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))))))) < -1e-100 or 0.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 43.9%

      \[\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.f6425.0

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

      \[\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.1

        \[\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.1%

      \[\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.1

        \[\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.1%

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

    if -1e-100 < (+.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))))))) < 0.0

    1. Initial program 10.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-*.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{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}} \]
      2. lift--.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]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}} \]
      3. distribute-lft-out--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}{2 \cdot a} \cdot \left(-g\right) - \frac{1}{2 \cdot a} \cdot \sqrt{g \cdot g - h \cdot h}}} \]
      4. cancel-sign-sub-invN/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}{2 \cdot a} \cdot \left(-g\right) + \left(\mathsf{neg}\left(\frac{1}{2 \cdot a}\right)\right) \cdot \sqrt{g \cdot g - h \cdot h}}} \]
      5. lift-/.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]{\frac{1}{2 \cdot a} \cdot \left(-g\right) + \left(\mathsf{neg}\left(\color{blue}{\frac{1}{2 \cdot a}}\right)\right) \cdot \sqrt{g \cdot g - h \cdot h}} \]
      6. distribute-frac-neg2N/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{1}{2 \cdot a} \cdot \left(-g\right) + \color{blue}{\frac{1}{\mathsf{neg}\left(2 \cdot a\right)}} \cdot \sqrt{g \cdot g - h \cdot h}} \]
      7. lift-neg.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]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(\mathsf{neg}\left(g\right)\right)} + \frac{1}{\mathsf{neg}\left(2 \cdot a\right)} \cdot \sqrt{g \cdot g - h \cdot h}} \]
      8. distribute-rgt-neg-outN/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}{\left(\mathsf{neg}\left(\frac{1}{2 \cdot a} \cdot g\right)\right)} + \frac{1}{\mathsf{neg}\left(2 \cdot a\right)} \cdot \sqrt{g \cdot g - h \cdot h}} \]
      9. distribute-lft-neg-inN/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}{\left(\mathsf{neg}\left(\frac{1}{2 \cdot a}\right)\right) \cdot g} + \frac{1}{\mathsf{neg}\left(2 \cdot a\right)} \cdot \sqrt{g \cdot g - h \cdot h}} \]
      10. lift-/.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]{\left(\mathsf{neg}\left(\color{blue}{\frac{1}{2 \cdot a}}\right)\right) \cdot g + \frac{1}{\mathsf{neg}\left(2 \cdot a\right)} \cdot \sqrt{g \cdot g - h \cdot h}} \]
      11. distribute-frac-neg2N/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}{\mathsf{neg}\left(2 \cdot a\right)}} \cdot g + \frac{1}{\mathsf{neg}\left(2 \cdot a\right)} \cdot \sqrt{g \cdot g - h \cdot h}} \]
      12. lower-fma.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}{\mathsf{fma}\left(\frac{1}{\mathsf{neg}\left(2 \cdot a\right)}, g, \frac{1}{\mathsf{neg}\left(2 \cdot a\right)} \cdot \sqrt{g \cdot g - h \cdot h}\right)}} \]
    4. Applied rewrites10.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}{\mathsf{fma}\left(-\frac{0.5}{a}, g, \left(-\frac{0.5}{a}\right) \cdot \sqrt{\left(g - h\right) \cdot \left(h + g\right)}\right)}} \]
    5. Applied rewrites32.0%

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

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

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

    \[\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 -1 \cdot 10^{-100}:\\ \;\;\;\;\sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\ \mathbf{elif}\;\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 0:\\ \;\;\;\;\frac{\sqrt[3]{-g}}{\sqrt[3]{a}} + \sqrt[3]{\left(\sqrt{g \cdot g - h \cdot h} - g\right) \cdot \frac{1}{a \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 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{-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 41.8%

    \[\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.f6424.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{\color{blue}{-g}}{a}} \]
  5. Applied rewrites24.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{{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.f6473.3

      \[\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 rewrites73.3%

    \[\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-+.f6473.3

      \[\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 rewrites73.3%

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

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

Alternative 4: 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 41.8%

    \[\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.f6424.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{\color{blue}{-g}}{a}} \]
  5. Applied rewrites24.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 \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.3

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

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

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

Alternative 5: 3.0% 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 41.8%

    \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-\sqrt[3]{\frac{g \cdot 0}{a}} \cdot \sqrt[3]{0.5}} \]
  8. Taylor expanded in g around 0

    \[\leadsto 0 \]
  9. Step-by-step derivation
    1. Applied rewrites3.0%

      \[\leadsto 0 \]
    2. Add Preprocessing

    Reproduce

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