2-ancestry mixing, positive discriminant

Percentage Accurate: 43.5% → 95.8%
Time: 17.3s
Alternatives: 9
Speedup: 2.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 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.5% 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, 1.0× speedup?

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

\\
\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot \sqrt[3]{-1}
\end{array}
Derivation
  1. Initial program 43.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]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
  4. Step-by-step derivation
    1. mul-1-negN/A

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

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

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

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

    \[\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}{0 - \frac{g}{a}}} \]
  6. Taylor expanded in g around inf

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
    4. cbrt-lowering-cbrt.f6478.0

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

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

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

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

      \[\leadsto \frac{\color{blue}{\sqrt[3]{g}}}{\sqrt[3]{a}} \cdot \sqrt[3]{-1} \]
    4. cbrt-lowering-cbrt.f6495.0

      \[\leadsto \frac{\sqrt[3]{g}}{\color{blue}{\sqrt[3]{a}}} \cdot \sqrt[3]{-1} \]
  10. Applied egg-rr95.0%

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

Alternative 2: 80.2% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{a \cdot 2}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{+116}:\\ \;\;\;\;\frac{\sqrt[3]{g}}{{\left(0 - a\right)}^{0.3333333333333333}}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+115}:\\ \;\;\;\;\sqrt[3]{g \cdot \frac{-1}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(0 - g\right)}^{0.3333333333333333}}{\sqrt[3]{a}}\\ \end{array} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* a 2.0))))
   (if (<= t_0 -4e+116)
     (/ (cbrt g) (pow (- 0.0 a) 0.3333333333333333))
     (if (<= t_0 5e+115)
       (cbrt (* g (/ -1.0 a)))
       (/ (pow (- 0.0 g) 0.3333333333333333) (cbrt a))))))
double code(double g, double h, double a) {
	double t_0 = 1.0 / (a * 2.0);
	double tmp;
	if (t_0 <= -4e+116) {
		tmp = cbrt(g) / pow((0.0 - a), 0.3333333333333333);
	} else if (t_0 <= 5e+115) {
		tmp = cbrt((g * (-1.0 / a)));
	} else {
		tmp = pow((0.0 - g), 0.3333333333333333) / cbrt(a);
	}
	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 <= -4e+116) {
		tmp = Math.cbrt(g) / Math.pow((0.0 - a), 0.3333333333333333);
	} else if (t_0 <= 5e+115) {
		tmp = Math.cbrt((g * (-1.0 / a)));
	} else {
		tmp = Math.pow((0.0 - g), 0.3333333333333333) / Math.cbrt(a);
	}
	return tmp;
}
function code(g, h, a)
	t_0 = Float64(1.0 / Float64(a * 2.0))
	tmp = 0.0
	if (t_0 <= -4e+116)
		tmp = Float64(cbrt(g) / (Float64(0.0 - a) ^ 0.3333333333333333));
	elseif (t_0 <= 5e+115)
		tmp = cbrt(Float64(g * Float64(-1.0 / a)));
	else
		tmp = Float64((Float64(0.0 - g) ^ 0.3333333333333333) / cbrt(a));
	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, -4e+116], N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[N[(0.0 - a), $MachinePrecision], 0.3333333333333333], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+115], N[Power[N[(g * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], N[(N[Power[N[(0.0 - g), $MachinePrecision], 0.3333333333333333], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\sqrt[3]{g \cdot \frac{-1}{a}}\\

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


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

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

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

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

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

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

      \[\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}{0 - \frac{g}{a}}} \]
    6. Taylor expanded in g around inf

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

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

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

        \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
      4. cbrt-lowering-cbrt.f6448.1

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{0 - a}}} \]
      6. cbrt-divN/A

        \[\leadsto \color{blue}{\frac{\sqrt[3]{g}}{\sqrt[3]{0 - a}}} \]
      7. unpow1/3N/A

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

        \[\leadsto \color{blue}{\frac{\sqrt[3]{g}}{{\left(0 - a\right)}^{\frac{1}{3}}}} \]
      9. cbrt-lowering-cbrt.f64N/A

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

        \[\leadsto \frac{\sqrt[3]{g}}{\color{blue}{{\left(0 - a\right)}^{\frac{1}{3}}}} \]
      11. --lowering--.f6486.1

        \[\leadsto \frac{\sqrt[3]{g}}{{\color{blue}{\left(0 - a\right)}}^{0.3333333333333333}} \]
    10. Applied egg-rr86.1%

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

    if -4.00000000000000006e116 < (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) < 5.00000000000000008e115

    1. Initial program 45.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
      4. cbrt-lowering-cbrt.f6491.7

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

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

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

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

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

        \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
      5. cbrt-lowering-cbrt.f64N/A

        \[\leadsto \color{blue}{\sqrt[3]{0 - \frac{g}{a}}} \]
      6. --lowering--.f64N/A

        \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
      7. /-lowering-/.f6491.7

        \[\leadsto \sqrt[3]{0 - \color{blue}{\frac{g}{a}}} \]
    10. Applied egg-rr91.7%

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

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

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

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

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

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

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

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

    if 5.00000000000000008e115 < (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 30.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]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
      4. cbrt-lowering-cbrt.f6433.6

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\color{blue}{\left(0 - g\right)}}^{\frac{1}{3}}}{\sqrt[3]{a}} \]
      11. cbrt-lowering-cbrt.f6459.1

        \[\leadsto \frac{{\left(0 - g\right)}^{0.3333333333333333}}{\color{blue}{\sqrt[3]{a}}} \]
    10. Applied egg-rr59.1%

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

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

Alternative 3: 80.1% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{a \cdot 2}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{+116}:\\ \;\;\;\;\frac{\sqrt[3]{g}}{{\left(0 - a\right)}^{0.3333333333333333}}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+115}:\\ \;\;\;\;\sqrt[3]{g \cdot \frac{-1}{a}}\\ \mathbf{else}:\\ \;\;\;\;{\left(0 - g\right)}^{0.3333333333333333} \cdot {a}^{-0.3333333333333333}\\ \end{array} \end{array} \]
(FPCore (g h a)
 :precision binary64
 (let* ((t_0 (/ 1.0 (* a 2.0))))
   (if (<= t_0 -4e+116)
     (/ (cbrt g) (pow (- 0.0 a) 0.3333333333333333))
     (if (<= t_0 5e+115)
       (cbrt (* g (/ -1.0 a)))
       (* (pow (- 0.0 g) 0.3333333333333333) (pow a -0.3333333333333333))))))
double code(double g, double h, double a) {
	double t_0 = 1.0 / (a * 2.0);
	double tmp;
	if (t_0 <= -4e+116) {
		tmp = cbrt(g) / pow((0.0 - a), 0.3333333333333333);
	} else if (t_0 <= 5e+115) {
		tmp = cbrt((g * (-1.0 / a)));
	} else {
		tmp = pow((0.0 - g), 0.3333333333333333) * pow(a, -0.3333333333333333);
	}
	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 <= -4e+116) {
		tmp = Math.cbrt(g) / Math.pow((0.0 - a), 0.3333333333333333);
	} else if (t_0 <= 5e+115) {
		tmp = Math.cbrt((g * (-1.0 / a)));
	} else {
		tmp = Math.pow((0.0 - g), 0.3333333333333333) * Math.pow(a, -0.3333333333333333);
	}
	return tmp;
}
function code(g, h, a)
	t_0 = Float64(1.0 / Float64(a * 2.0))
	tmp = 0.0
	if (t_0 <= -4e+116)
		tmp = Float64(cbrt(g) / (Float64(0.0 - a) ^ 0.3333333333333333));
	elseif (t_0 <= 5e+115)
		tmp = cbrt(Float64(g * Float64(-1.0 / a)));
	else
		tmp = Float64((Float64(0.0 - g) ^ 0.3333333333333333) * (a ^ -0.3333333333333333));
	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, -4e+116], N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[N[(0.0 - a), $MachinePrecision], 0.3333333333333333], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+115], N[Power[N[(g * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], N[(N[Power[N[(0.0 - g), $MachinePrecision], 0.3333333333333333], $MachinePrecision] * N[Power[a, -0.3333333333333333], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\sqrt[3]{g \cdot \frac{-1}{a}}\\

\mathbf{else}:\\
\;\;\;\;{\left(0 - g\right)}^{0.3333333333333333} \cdot {a}^{-0.3333333333333333}\\


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

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

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

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

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

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

      \[\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}{0 - \frac{g}{a}}} \]
    6. Taylor expanded in g around inf

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

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

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

        \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
      4. cbrt-lowering-cbrt.f6448.1

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{0 - a}}} \]
      6. cbrt-divN/A

        \[\leadsto \color{blue}{\frac{\sqrt[3]{g}}{\sqrt[3]{0 - a}}} \]
      7. unpow1/3N/A

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

        \[\leadsto \color{blue}{\frac{\sqrt[3]{g}}{{\left(0 - a\right)}^{\frac{1}{3}}}} \]
      9. cbrt-lowering-cbrt.f64N/A

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

        \[\leadsto \frac{\sqrt[3]{g}}{\color{blue}{{\left(0 - a\right)}^{\frac{1}{3}}}} \]
      11. --lowering--.f6486.1

        \[\leadsto \frac{\sqrt[3]{g}}{{\color{blue}{\left(0 - a\right)}}^{0.3333333333333333}} \]
    10. Applied egg-rr86.1%

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

    if -4.00000000000000006e116 < (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) < 5.00000000000000008e115

    1. Initial program 45.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
      4. cbrt-lowering-cbrt.f6491.7

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

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

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

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

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

        \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
      5. cbrt-lowering-cbrt.f64N/A

        \[\leadsto \color{blue}{\sqrt[3]{0 - \frac{g}{a}}} \]
      6. --lowering--.f64N/A

        \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
      7. /-lowering-/.f6491.7

        \[\leadsto \sqrt[3]{0 - \color{blue}{\frac{g}{a}}} \]
    10. Applied egg-rr91.7%

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

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

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

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

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

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

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

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

    if 5.00000000000000008e115 < (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 30.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]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
      4. cbrt-lowering-cbrt.f6433.6

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

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

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

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

        \[\leadsto {-1}^{\frac{1}{3}} \cdot \color{blue}{{\left(\frac{g}{a}\right)}^{\frac{1}{3}}} \]
      4. pow-prod-downN/A

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

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

        \[\leadsto {\left(\mathsf{neg}\left(\color{blue}{g \cdot \frac{1}{a}}\right)\right)}^{\frac{1}{3}} \]
      7. distribute-lft-neg-inN/A

        \[\leadsto {\color{blue}{\left(\left(\mathsf{neg}\left(g\right)\right) \cdot \frac{1}{a}\right)}}^{\frac{1}{3}} \]
      8. unpow-prod-downN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(0 - g\right)}^{\frac{1}{3}} \cdot \color{blue}{{a}^{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}} \]
      18. metadata-eval58.0

        \[\leadsto {\left(0 - g\right)}^{0.3333333333333333} \cdot {a}^{\color{blue}{-0.3333333333333333}} \]
    10. Applied egg-rr58.0%

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

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

Alternative 4: 73.2% accurate, 1.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{\left(0 - g\right)}^{0.3333333333333333} \cdot {a}^{-0.3333333333333333}\\


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

    1. Initial program 45.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
      4. cbrt-lowering-cbrt.f6484.3

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

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

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

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

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

        \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
      5. cbrt-lowering-cbrt.f64N/A

        \[\leadsto \color{blue}{\sqrt[3]{0 - \frac{g}{a}}} \]
      6. --lowering--.f64N/A

        \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
      7. /-lowering-/.f6484.3

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

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

        \[\leadsto \sqrt[3]{0 - \color{blue}{\frac{1}{\frac{a}{g}}}} \]
      2. div-invN/A

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

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

        \[\leadsto \sqrt[3]{0 - \color{blue}{\frac{\frac{1}{a}}{\frac{1}{g}}}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \sqrt[3]{0 - \frac{\color{blue}{\frac{1}{a}}}{\frac{1}{g}}} \]
      6. /-lowering-/.f6484.4

        \[\leadsto \sqrt[3]{0 - \frac{\frac{1}{a}}{\color{blue}{\frac{1}{g}}}} \]
    12. Applied egg-rr84.4%

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

    if 5.00000000000000008e115 < (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 30.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]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
      4. cbrt-lowering-cbrt.f6433.6

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

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

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

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

        \[\leadsto {-1}^{\frac{1}{3}} \cdot \color{blue}{{\left(\frac{g}{a}\right)}^{\frac{1}{3}}} \]
      4. pow-prod-downN/A

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

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

        \[\leadsto {\left(\mathsf{neg}\left(\color{blue}{g \cdot \frac{1}{a}}\right)\right)}^{\frac{1}{3}} \]
      7. distribute-lft-neg-inN/A

        \[\leadsto {\color{blue}{\left(\left(\mathsf{neg}\left(g\right)\right) \cdot \frac{1}{a}\right)}}^{\frac{1}{3}} \]
      8. unpow-prod-downN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(0 - g\right)}^{\frac{1}{3}} \cdot \color{blue}{{a}^{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}} \]
      18. metadata-eval58.0

        \[\leadsto {\left(0 - g\right)}^{0.3333333333333333} \cdot {a}^{\color{blue}{-0.3333333333333333}} \]
    10. Applied egg-rr58.0%

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

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

Alternative 5: 95.8% accurate, 1.4× speedup?

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

\\
\sqrt[3]{g} \cdot \sqrt[3]{\frac{-1}{a}}
\end{array}
Derivation
  1. Initial program 43.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]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
  4. Step-by-step derivation
    1. mul-1-negN/A

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

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

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

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

    \[\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}{0 - \frac{g}{a}}} \]
  6. Taylor expanded in g around inf

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
    4. cbrt-lowering-cbrt.f6478.0

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

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

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

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

      \[\leadsto \frac{\color{blue}{\sqrt[3]{g}}}{\sqrt[3]{a}} \cdot \sqrt[3]{-1} \]
    4. cbrt-lowering-cbrt.f6495.0

      \[\leadsto \frac{\sqrt[3]{g}}{\color{blue}{\sqrt[3]{a}}} \cdot \sqrt[3]{-1} \]
  10. Applied egg-rr95.0%

    \[\leadsto \color{blue}{\frac{\sqrt[3]{g}}{\sqrt[3]{a}}} \cdot \sqrt[3]{-1} \]
  11. Step-by-step derivation
    1. associate-*l/N/A

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

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

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

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

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

      \[\leadsto \sqrt[3]{g} \cdot \color{blue}{\sqrt[3]{\frac{-1}{a}}} \]
    7. /-lowering-/.f6495.0

      \[\leadsto \sqrt[3]{g} \cdot \sqrt[3]{\color{blue}{\frac{-1}{a}}} \]
  12. Applied egg-rr95.0%

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

Alternative 6: 73.6% accurate, 2.3× speedup?

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

\\
\sqrt[3]{\frac{\frac{1}{a}}{\frac{-1}{g}}}
\end{array}
Derivation
  1. Initial program 43.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]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
  4. Step-by-step derivation
    1. mul-1-negN/A

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

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

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

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

    \[\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}{0 - \frac{g}{a}}} \]
  6. Taylor expanded in g around inf

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
    4. cbrt-lowering-cbrt.f6478.0

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

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

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
    5. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \color{blue}{\sqrt[3]{0 - \frac{g}{a}}} \]
    6. --lowering--.f64N/A

      \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
    7. /-lowering-/.f6478.0

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

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

      \[\leadsto \sqrt[3]{0 - \color{blue}{\frac{1}{\frac{a}{g}}}} \]
    2. div-invN/A

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

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

      \[\leadsto \sqrt[3]{0 - \color{blue}{\frac{\frac{1}{a}}{\frac{1}{g}}}} \]
    5. /-lowering-/.f64N/A

      \[\leadsto \sqrt[3]{0 - \frac{\color{blue}{\frac{1}{a}}}{\frac{1}{g}}} \]
    6. /-lowering-/.f6478.0

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

    \[\leadsto \sqrt[3]{0 - \color{blue}{\frac{\frac{1}{a}}{\frac{1}{g}}}} \]
  13. Final simplification78.0%

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

Alternative 7: 73.6% accurate, 2.6× speedup?

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

\\
\sqrt[3]{g \cdot \frac{-1}{a}}
\end{array}
Derivation
  1. Initial program 43.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]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
  4. Step-by-step derivation
    1. mul-1-negN/A

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

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

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

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

    \[\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}{0 - \frac{g}{a}}} \]
  6. Taylor expanded in g around inf

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
    4. cbrt-lowering-cbrt.f6478.0

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

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

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
    5. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \color{blue}{\sqrt[3]{0 - \frac{g}{a}}} \]
    6. --lowering--.f64N/A

      \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
    7. /-lowering-/.f6478.0

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

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

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

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

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

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

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

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

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

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

Alternative 8: 73.6% accurate, 2.6× speedup?

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

\\
\sqrt[3]{0 - \frac{g}{a}}
\end{array}
Derivation
  1. Initial program 43.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]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
  4. Step-by-step derivation
    1. mul-1-negN/A

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

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

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

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

    \[\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}{0 - \frac{g}{a}}} \]
  6. Taylor expanded in g around inf

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
    4. cbrt-lowering-cbrt.f6478.0

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

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

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
    5. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \color{blue}{\sqrt[3]{0 - \frac{g}{a}}} \]
    6. --lowering--.f64N/A

      \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
    7. /-lowering-/.f6478.0

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

    \[\leadsto \color{blue}{\sqrt[3]{0 - \frac{g}{a}}} \]
  11. Step-by-step derivation
    1. flip3--N/A

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

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

      \[\leadsto \sqrt[3]{\frac{\color{blue}{\mathsf{neg}\left({\left(\frac{g}{a}\right)}^{3}\right)}}{0 \cdot 0 + \left(\frac{g}{a} \cdot \frac{g}{a} + 0 \cdot \frac{g}{a}\right)}} \]
    4. cube-negN/A

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

      \[\leadsto \sqrt[3]{\frac{{\color{blue}{\left(\frac{\mathsf{neg}\left(g\right)}{a}\right)}}^{3}}{0 \cdot 0 + \left(\frac{g}{a} \cdot \frac{g}{a} + 0 \cdot \frac{g}{a}\right)}} \]
    6. cube-divN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt[3]{\frac{\frac{{g}^{\color{blue}{3}}}{{a}^{3}}}{0 \cdot 0 + \left(\frac{g}{a} \cdot \frac{g}{a} + 0 \cdot \frac{g}{a}\right)}} \]
    18. cube-divN/A

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

      \[\leadsto \sqrt[3]{\frac{{\left(\frac{g}{a}\right)}^{3}}{\color{blue}{0} + \left(\frac{g}{a} \cdot \frac{g}{a} + 0 \cdot \frac{g}{a}\right)}} \]
    20. +-lft-identityN/A

      \[\leadsto \sqrt[3]{\frac{{\left(\frac{g}{a}\right)}^{3}}{\color{blue}{\frac{g}{a} \cdot \frac{g}{a} + 0 \cdot \frac{g}{a}}}} \]
    21. distribute-rgt-outN/A

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

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

    \[\leadsto \sqrt[3]{\color{blue}{-\frac{g}{a}}} \]
  13. Final simplification78.0%

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

Alternative 9: 1.4% accurate, 2.7× speedup?

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

\\
\sqrt[3]{\frac{g}{a}}
\end{array}
Derivation
  1. Initial program 43.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]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
  4. Step-by-step derivation
    1. mul-1-negN/A

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

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

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

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

    \[\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}{0 - \frac{g}{a}}} \]
  6. Taylor expanded in g around inf

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{g}{a}}} \cdot \sqrt[3]{-1} \]
    4. cbrt-lowering-cbrt.f6478.0

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

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

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

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

      \[\leadsto \frac{\color{blue}{\sqrt[3]{g}}}{\sqrt[3]{a}} \cdot \sqrt[3]{-1} \]
    4. cbrt-lowering-cbrt.f6495.0

      \[\leadsto \frac{\sqrt[3]{g}}{\color{blue}{\sqrt[3]{a}}} \cdot \sqrt[3]{-1} \]
  10. Applied egg-rr95.0%

    \[\leadsto \color{blue}{\frac{\sqrt[3]{g}}{\sqrt[3]{a}}} \cdot \sqrt[3]{-1} \]
  11. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{0 - \frac{g}{a}}} \]
    6. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \color{blue}{\sqrt[3]{0 - \frac{g}{a}}} \]
    7. flip3--N/A

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

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

Reproduce

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