2-ancestry mixing, positive discriminant

Percentage Accurate: 43.4% → 95.8%
Time: 12.5s
Alternatives: 5
Speedup: 2.4×

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: 43.4% 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.8% accurate, 0.9× speedup?

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

\\
\sqrt[3]{\frac{0}{a}} + \sqrt[3]{0.5 \cdot g} \cdot \sqrt[3]{\frac{-2}{a}}
\end{array}
Derivation
  1. Initial program 41.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt[3]{\frac{0}{a}} + \sqrt[3]{\frac{1}{2} \cdot \frac{\color{blue}{g \cdot -2}}{a}} \]
    10. associate-/l*N/A

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

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

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

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

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

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

      \[\leadsto \sqrt[3]{\frac{0}{a}} + \sqrt[3]{\frac{1}{2} \cdot g} \cdot \color{blue}{\sqrt[3]{\frac{-2}{a}}} \]
    17. lower-/.f6494.8

      \[\leadsto \sqrt[3]{\frac{0}{a}} + \sqrt[3]{0.5 \cdot g} \cdot \sqrt[3]{\color{blue}{\frac{-2}{a}}} \]
  12. Applied egg-rr94.8%

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

Alternative 2: 81.1% accurate, 0.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{0}{a}} + {\left(a \cdot 2\right)}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot -2}\\


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

    1. Initial program 42.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(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(-2 \cdot g\right)}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e112 < (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 30.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\frac{0}{a}} + \color{blue}{\sqrt[3]{\frac{1}{2 \cdot a}} \cdot \sqrt[3]{g \cdot -2}} \]
      5. pow1/3N/A

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\frac{0}{a}} + {\left(2 \cdot a\right)}^{\color{blue}{\frac{-1}{3}}} \cdot \sqrt[3]{g \cdot -2} \]
      12. lift-pow.f6487.8

        \[\leadsto \sqrt[3]{\frac{0}{a}} + \color{blue}{{\left(2 \cdot a\right)}^{-0.3333333333333333}} \cdot \sqrt[3]{g \cdot -2} \]
    12. Applied egg-rr87.8%

      \[\leadsto \sqrt[3]{\frac{0}{a}} + \color{blue}{{\left(2 \cdot a\right)}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot -2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.7%

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

Alternative 3: 74.2% accurate, 1.1× speedup?

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

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

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

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

      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
    2. lower-*.f6425.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{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
  5. Simplified25.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{1}{2 \cdot a} \cdot \color{blue}{\left(g \cdot -2\right)}} \]
  6. Taylor expanded in g around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 72.7% accurate, 1.3× speedup?

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

\\
\sqrt[3]{\frac{0}{a}} - \sqrt[3]{\frac{g}{a}}
\end{array}
Derivation
  1. Initial program 41.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt[3]{\frac{0}{a}} + \left(-\sqrt[3]{\color{blue}{\frac{g}{a}}}\right) \]
  13. Simplified71.4%

    \[\leadsto \sqrt[3]{\frac{0}{a}} + \color{blue}{\left(-\sqrt[3]{\frac{g}{a}}\right)} \]
  14. Final simplification71.4%

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

Alternative 5: 72.6% accurate, 2.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\color{blue}{0}}^{\frac{1}{3}} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(g \cdot -2\right)} \]
    5. metadata-eval71.4

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

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

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

Reproduce

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