2-ancestry mixing, positive discriminant

Percentage Accurate: 44.0% → 95.9%
Time: 18.3s
Alternatives: 4
Speedup: 4.1×

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 4 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 44.0% 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.9% accurate, 2.1× speedup?

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

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

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

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

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

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

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

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{\frac{1}{2}}\right) \cdot \color{blue}{\sqrt[3]{2}}\right)\right) \]
    5. *-lowering-*.f64N/A

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

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\sqrt[3]{\frac{g}{a}}\right), \left(\sqrt[3]{\frac{1}{2}}\right)\right), \left(\sqrt[3]{\color{blue}{2}}\right)\right)\right) \]
    7. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{g}{a}\right)\right), \left(\sqrt[3]{\frac{1}{2}}\right)\right), \left(\sqrt[3]{2}\right)\right)\right) \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \left(\sqrt[3]{\frac{1}{2}}\right)\right), \left(\sqrt[3]{2}\right)\right)\right) \]
    9. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \mathsf{cbrt.f64}\left(\frac{1}{2}\right)\right), \left(\sqrt[3]{2}\right)\right)\right) \]
    10. cbrt-lowering-cbrt.f6472.2%

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \mathsf{cbrt.f64}\left(\frac{1}{2}\right)\right), \mathsf{cbrt.f64}\left(2\right)\right)\right) \]
  5. Simplified72.2%

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

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\sqrt[3]{\frac{g}{a}} \cdot \color{blue}{\left(\sqrt[3]{\frac{1}{2}} \cdot \sqrt[3]{2}\right)}\right)\right) \]
    2. cbrt-divN/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot \left(\color{blue}{\sqrt[3]{\frac{1}{2}}} \cdot \sqrt[3]{2}\right)\right)\right) \]
    3. cbrt-unprodN/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot \sqrt[3]{\frac{1}{2} \cdot 2}\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot \sqrt[3]{1}\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot 1\right)\right) \]
    6. associate-*l/N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g} \cdot 1}{\color{blue}{\sqrt[3]{a}}}\right)\right) \]
    7. /-lowering-/.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot 1\right), \color{blue}{\left(\sqrt[3]{a}\right)}\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\sqrt[3]{g}\right), 1\right), \left(\sqrt[3]{\color{blue}{a}}\right)\right)\right) \]
    9. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(g\right), 1\right), \left(\sqrt[3]{a}\right)\right)\right) \]
    10. cbrt-lowering-cbrt.f6496.4%

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(g\right), 1\right), \mathsf{cbrt.f64}\left(a\right)\right)\right) \]
  7. Applied egg-rr96.4%

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\sqrt[3]{g} \cdot 1\right)\right), \color{blue}{\left(\sqrt[3]{a}\right)}\right) \]
    4. neg-sub0N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, \left(\sqrt[3]{g} \cdot 1\right)\right), \left(\sqrt[3]{\color{blue}{a}}\right)\right) \]
    6. *-rgt-identityN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, \left(\sqrt[3]{g}\right)\right), \left(\sqrt[3]{a}\right)\right) \]
    7. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{cbrt.f64}\left(g\right)\right), \left(\sqrt[3]{a}\right)\right) \]
    8. cbrt-lowering-cbrt.f6496.4%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
  9. Applied egg-rr96.4%

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{neg.f64}\left(\left(\sqrt[3]{g}\right)\right), \mathsf{cbrt.f64}\left(\color{blue}{a}\right)\right) \]
    3. cbrt-lowering-cbrt.f6496.4%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{neg.f64}\left(\mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
  11. Applied egg-rr96.4%

    \[\leadsto \frac{\color{blue}{-\sqrt[3]{g}}}{\sqrt[3]{a}} \]
  12. Final simplification96.4%

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

Alternative 2: 73.6% accurate, 3.8× speedup?

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

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

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

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

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

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

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

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{\frac{1}{2}}\right) \cdot \color{blue}{\sqrt[3]{2}}\right)\right) \]
    5. *-lowering-*.f64N/A

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

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\sqrt[3]{\frac{g}{a}}\right), \left(\sqrt[3]{\frac{1}{2}}\right)\right), \left(\sqrt[3]{\color{blue}{2}}\right)\right)\right) \]
    7. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{g}{a}\right)\right), \left(\sqrt[3]{\frac{1}{2}}\right)\right), \left(\sqrt[3]{2}\right)\right)\right) \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \left(\sqrt[3]{\frac{1}{2}}\right)\right), \left(\sqrt[3]{2}\right)\right)\right) \]
    9. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \mathsf{cbrt.f64}\left(\frac{1}{2}\right)\right), \left(\sqrt[3]{2}\right)\right)\right) \]
    10. cbrt-lowering-cbrt.f6472.2%

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \mathsf{cbrt.f64}\left(\frac{1}{2}\right)\right), \mathsf{cbrt.f64}\left(2\right)\right)\right) \]
  5. Simplified72.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\left(\sqrt[3]{\frac{g}{a}}\right), \color{blue}{\left(\frac{-1}{2} \cdot 2\right)}\right) \]
    10. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{g}{a}\right)\right), \left(\color{blue}{\frac{-1}{2}} \cdot 2\right)\right) \]
    11. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \left(\frac{-1}{2} \cdot 2\right)\right) \]
    12. metadata-eval72.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), -1\right) \]
  7. Applied egg-rr72.9%

    \[\leadsto \color{blue}{\sqrt[3]{\frac{g}{a}} \cdot -1} \]
  8. Step-by-step derivation
    1. rem-exp-logN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(e^{\log \left(\frac{g}{a}\right)}\right)\right), -1\right) \]
    2. rem-cube-cbrtN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left({\left(\sqrt[3]{e^{\log \left(\frac{g}{a}\right)}}\right)}^{3}\right)\right), -1\right) \]
    3. rem-exp-logN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left({\left(\sqrt[3]{\frac{g}{a}}\right)}^{3}\right)\right), -1\right) \]
    4. cbrt-divN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left({\left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}}\right)}^{3}\right)\right), -1\right) \]
    5. *-rgt-identityN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left({\left(\frac{\sqrt[3]{g} \cdot 1}{\sqrt[3]{a}}\right)}^{3}\right)\right), -1\right) \]
    6. frac-2negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left({\left(\frac{\mathsf{neg}\left(\sqrt[3]{g} \cdot 1\right)}{\mathsf{neg}\left(\sqrt[3]{a}\right)}\right)}^{3}\right)\right), -1\right) \]
    7. div-invN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left({\left(\left(\mathsf{neg}\left(\sqrt[3]{g} \cdot 1\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\sqrt[3]{a}\right)}\right)}^{3}\right)\right), -1\right) \]
    8. unpow-prod-downN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left({\left(\mathsf{neg}\left(\sqrt[3]{g} \cdot 1\right)\right)}^{3} \cdot {\left(\frac{1}{\mathsf{neg}\left(\sqrt[3]{a}\right)}\right)}^{3}\right)\right), -1\right) \]
    9. cube-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\left(\mathsf{neg}\left({\left(\sqrt[3]{g} \cdot 1\right)}^{3}\right)\right) \cdot {\left(\frac{1}{\mathsf{neg}\left(\sqrt[3]{a}\right)}\right)}^{3}\right)\right), -1\right) \]
    10. *-rgt-identityN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\left(\mathsf{neg}\left({\left(\sqrt[3]{g}\right)}^{3}\right)\right) \cdot {\left(\frac{1}{\mathsf{neg}\left(\sqrt[3]{a}\right)}\right)}^{3}\right)\right), -1\right) \]
    11. rem-cube-cbrtN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\left(\mathsf{neg}\left(g\right)\right) \cdot {\left(\frac{1}{\mathsf{neg}\left(\sqrt[3]{a}\right)}\right)}^{3}\right)\right), -1\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{neg}\left(g\right)\right), \left({\left(\frac{1}{\mathsf{neg}\left(\sqrt[3]{a}\right)}\right)}^{3}\right)\right)\right), -1\right) \]
    13. neg-sub0N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{*.f64}\left(\left(0 - g\right), \left({\left(\frac{1}{\mathsf{neg}\left(\sqrt[3]{a}\right)}\right)}^{3}\right)\right)\right), -1\right) \]
    14. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(0, g\right), \left({\left(\frac{1}{\mathsf{neg}\left(\sqrt[3]{a}\right)}\right)}^{3}\right)\right)\right), -1\right) \]
    15. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(0, g\right), \mathsf{pow.f64}\left(\left(\frac{1}{\mathsf{neg}\left(\sqrt[3]{a}\right)}\right), 3\right)\right)\right), -1\right) \]
    16. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(0, g\right), \mathsf{pow.f64}\left(\mathsf{/.f64}\left(1, \left(\mathsf{neg}\left(\sqrt[3]{a}\right)\right)\right), 3\right)\right)\right), -1\right) \]
    17. neg-sub0N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(0, g\right), \mathsf{pow.f64}\left(\mathsf{/.f64}\left(1, \left(0 - \sqrt[3]{a}\right)\right), 3\right)\right)\right), -1\right) \]
    18. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(0, g\right), \mathsf{pow.f64}\left(\mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(0, \left(\sqrt[3]{a}\right)\right)\right), 3\right)\right)\right), -1\right) \]
    19. cbrt-lowering-cbrt.f6472.7%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(0, g\right), \mathsf{pow.f64}\left(\mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(0, \mathsf{cbrt.f64}\left(a\right)\right)\right), 3\right)\right)\right), -1\right) \]
  9. Applied egg-rr72.7%

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\left(\mathsf{neg}\left(g\right)\right) \cdot {\left(\frac{1}{0 - \sqrt[3]{a}}\right)}^{3}\right)\right), -1\right) \]
    2. cube-divN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\left(\mathsf{neg}\left(g\right)\right) \cdot \frac{{1}^{3}}{{\left(0 - \sqrt[3]{a}\right)}^{3}}\right)\right), -1\right) \]
    3. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\left(\mathsf{neg}\left(g\right)\right) \cdot \frac{1}{{\left(0 - \sqrt[3]{a}\right)}^{3}}\right)\right), -1\right) \]
    4. div-invN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{\mathsf{neg}\left(g\right)}{{\left(0 - \sqrt[3]{a}\right)}^{3}}\right)\right), -1\right) \]
    5. sub0-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{\mathsf{neg}\left(g\right)}{{\left(\mathsf{neg}\left(\sqrt[3]{a}\right)\right)}^{3}}\right)\right), -1\right) \]
    6. cube-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{\mathsf{neg}\left(g\right)}{\mathsf{neg}\left({\left(\sqrt[3]{a}\right)}^{3}\right)}\right)\right), -1\right) \]
    7. rem-cube-cbrtN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{\mathsf{neg}\left(g\right)}{\mathsf{neg}\left(a\right)}\right)\right), -1\right) \]
    8. frac-2negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{g}{a}\right)\right), -1\right) \]
    9. remove-double-divN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{1}{\frac{1}{\frac{g}{a}}}\right)\right), -1\right) \]
    10. inv-powN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{1}{{\left(\frac{g}{a}\right)}^{-1}}\right)\right), -1\right) \]
    11. pow-flipN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left({\left(\frac{g}{a}\right)}^{\left(\mathsf{neg}\left(-1\right)\right)}\right)\right), -1\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left({\left(\frac{g}{a}\right)}^{1}\right)\right), -1\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left({\left(\frac{g}{a}\right)}^{\left(2 + -1\right)}\right)\right), -1\right) \]
    14. pow-prod-upN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left({\left(\frac{g}{a}\right)}^{2} \cdot {\left(\frac{g}{a}\right)}^{-1}\right)\right), -1\right) \]
    15. pow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\left(\frac{g}{a} \cdot \frac{g}{a}\right) \cdot {\left(\frac{g}{a}\right)}^{-1}\right)\right), -1\right) \]
    16. clear-numN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\left(\frac{g}{a} \cdot \frac{1}{\frac{a}{g}}\right) \cdot {\left(\frac{g}{a}\right)}^{-1}\right)\right), -1\right) \]
    17. div-invN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{\frac{g}{a}}{\frac{a}{g}} \cdot {\left(\frac{g}{a}\right)}^{-1}\right)\right), -1\right) \]
    18. inv-powN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{\frac{g}{a}}{\frac{a}{g}} \cdot \frac{1}{\frac{g}{a}}\right)\right), -1\right) \]
    19. associate-/r/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{\frac{g}{a}}{\frac{a}{g}} \cdot \left(\frac{1}{g} \cdot a\right)\right)\right), -1\right) \]
    20. associate-*l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\left(\frac{\frac{g}{a}}{\frac{a}{g}} \cdot \frac{1}{g}\right) \cdot a\right)\right), -1\right) \]
    21. div-invN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{\frac{\frac{g}{a}}{\frac{a}{g}}}{g} \cdot a\right)\right), -1\right) \]
    22. associate-/l/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{\frac{g}{a}}{g \cdot \frac{a}{g}} \cdot a\right)\right), -1\right) \]
    23. associate-*l/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{\frac{g}{a} \cdot a}{g \cdot \frac{a}{g}}\right)\right), -1\right) \]
    24. div-invN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\left(\frac{g}{a} \cdot a\right) \cdot \frac{1}{g \cdot \frac{a}{g}}\right)\right), -1\right) \]
  11. Applied egg-rr73.0%

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

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

Alternative 3: 73.6% accurate, 4.1× speedup?

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

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

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

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

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

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

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

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{\frac{1}{2}}\right) \cdot \color{blue}{\sqrt[3]{2}}\right)\right) \]
    5. *-lowering-*.f64N/A

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

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\sqrt[3]{\frac{g}{a}}\right), \left(\sqrt[3]{\frac{1}{2}}\right)\right), \left(\sqrt[3]{\color{blue}{2}}\right)\right)\right) \]
    7. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{g}{a}\right)\right), \left(\sqrt[3]{\frac{1}{2}}\right)\right), \left(\sqrt[3]{2}\right)\right)\right) \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \left(\sqrt[3]{\frac{1}{2}}\right)\right), \left(\sqrt[3]{2}\right)\right)\right) \]
    9. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \mathsf{cbrt.f64}\left(\frac{1}{2}\right)\right), \left(\sqrt[3]{2}\right)\right)\right) \]
    10. cbrt-lowering-cbrt.f6472.2%

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \mathsf{cbrt.f64}\left(\frac{1}{2}\right)\right), \mathsf{cbrt.f64}\left(2\right)\right)\right) \]
  5. Simplified72.2%

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

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\sqrt[3]{\frac{g}{a}} \cdot \color{blue}{\left(\sqrt[3]{\frac{1}{2}} \cdot \sqrt[3]{2}\right)}\right)\right) \]
    2. cbrt-divN/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot \left(\color{blue}{\sqrt[3]{\frac{1}{2}}} \cdot \sqrt[3]{2}\right)\right)\right) \]
    3. cbrt-unprodN/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot \sqrt[3]{\frac{1}{2} \cdot 2}\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot \sqrt[3]{1}\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot 1\right)\right) \]
    6. associate-*l/N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g} \cdot 1}{\color{blue}{\sqrt[3]{a}}}\right)\right) \]
    7. /-lowering-/.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot 1\right), \color{blue}{\left(\sqrt[3]{a}\right)}\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\sqrt[3]{g}\right), 1\right), \left(\sqrt[3]{\color{blue}{a}}\right)\right)\right) \]
    9. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(g\right), 1\right), \left(\sqrt[3]{a}\right)\right)\right) \]
    10. cbrt-lowering-cbrt.f6496.4%

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(g\right), 1\right), \mathsf{cbrt.f64}\left(a\right)\right)\right) \]
  7. Applied egg-rr96.4%

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

      \[\leadsto \mathsf{neg}\left(\frac{\sqrt[3]{g} \cdot 1}{\sqrt[3]{a}}\right) \]
    2. *-rgt-identityN/A

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

      \[\leadsto \mathsf{neg}\left(\sqrt[3]{\frac{g}{a}}\right) \]
    4. *-rgt-identityN/A

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

      \[\leadsto \mathsf{neg.f64}\left(\left(\sqrt[3]{\frac{g}{a}} \cdot 1\right)\right) \]
    6. *-rgt-identityN/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\sqrt[3]{\frac{g}{a}}\right)\right) \]
    7. rem-exp-logN/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\sqrt[3]{e^{\log \left(\frac{g}{a}\right)}}\right)\right) \]
    8. unpow1/3N/A

      \[\leadsto \mathsf{neg.f64}\left(\left({\left(e^{\log \left(\frac{g}{a}\right)}\right)}^{\frac{1}{3}}\right)\right) \]
    9. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{pow.f64}\left(\left(e^{\log \left(\frac{g}{a}\right)}\right), \frac{1}{3}\right)\right) \]
    10. rem-exp-logN/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{pow.f64}\left(\left(\frac{g}{a}\right), \frac{1}{3}\right)\right) \]
    11. /-lowering-/.f6436.0%

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(g, a\right), \frac{1}{3}\right)\right) \]
  9. Applied egg-rr36.0%

    \[\leadsto \color{blue}{-{\left(\frac{g}{a}\right)}^{0.3333333333333333}} \]
  10. Step-by-step derivation
    1. pow1/3N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\sqrt[3]{\frac{g}{a}}\right)\right) \]
    2. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{g}{a}\right)\right)\right) \]
    3. /-lowering-/.f6472.9%

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right)\right) \]
  11. Applied egg-rr72.9%

    \[\leadsto -\color{blue}{\sqrt[3]{\frac{g}{a}}} \]
  12. Final simplification72.9%

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

Alternative 4: 1.4% accurate, 4.2× 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 41.8%

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

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

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

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

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

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{\frac{1}{2}}\right) \cdot \color{blue}{\sqrt[3]{2}}\right)\right) \]
    5. *-lowering-*.f64N/A

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

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\sqrt[3]{\frac{g}{a}}\right), \left(\sqrt[3]{\frac{1}{2}}\right)\right), \left(\sqrt[3]{\color{blue}{2}}\right)\right)\right) \]
    7. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{g}{a}\right)\right), \left(\sqrt[3]{\frac{1}{2}}\right)\right), \left(\sqrt[3]{2}\right)\right)\right) \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \left(\sqrt[3]{\frac{1}{2}}\right)\right), \left(\sqrt[3]{2}\right)\right)\right) \]
    9. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \mathsf{cbrt.f64}\left(\frac{1}{2}\right)\right), \left(\sqrt[3]{2}\right)\right)\right) \]
    10. cbrt-lowering-cbrt.f6472.2%

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, a\right)\right), \mathsf{cbrt.f64}\left(\frac{1}{2}\right)\right), \mathsf{cbrt.f64}\left(2\right)\right)\right) \]
  5. Simplified72.2%

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

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\sqrt[3]{\frac{g}{a}} \cdot \color{blue}{\left(\sqrt[3]{\frac{1}{2}} \cdot \sqrt[3]{2}\right)}\right)\right) \]
    2. cbrt-divN/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot \left(\color{blue}{\sqrt[3]{\frac{1}{2}}} \cdot \sqrt[3]{2}\right)\right)\right) \]
    3. cbrt-unprodN/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot \sqrt[3]{\frac{1}{2} \cdot 2}\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot \sqrt[3]{1}\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot 1\right)\right) \]
    6. associate-*l/N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \left(\frac{\sqrt[3]{g} \cdot 1}{\color{blue}{\sqrt[3]{a}}}\right)\right) \]
    7. /-lowering-/.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot 1\right), \color{blue}{\left(\sqrt[3]{a}\right)}\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\sqrt[3]{g}\right), 1\right), \left(\sqrt[3]{\color{blue}{a}}\right)\right)\right) \]
    9. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(g\right), 1\right), \left(\sqrt[3]{a}\right)\right)\right) \]
    10. cbrt-lowering-cbrt.f6496.4%

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(g\right), 1\right), \mathsf{cbrt.f64}\left(a\right)\right)\right) \]
  7. Applied egg-rr96.4%

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\sqrt[3]{g} \cdot 1\right)\right), \color{blue}{\left(\sqrt[3]{a}\right)}\right) \]
    4. neg-sub0N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, \left(\sqrt[3]{g} \cdot 1\right)\right), \left(\sqrt[3]{\color{blue}{a}}\right)\right) \]
    6. *-rgt-identityN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, \left(\sqrt[3]{g}\right)\right), \left(\sqrt[3]{a}\right)\right) \]
    7. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{cbrt.f64}\left(g\right)\right), \left(\sqrt[3]{a}\right)\right) \]
    8. cbrt-lowering-cbrt.f6496.4%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
  9. Applied egg-rr96.4%

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

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

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

      \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sqrt[3]{g}\right)\right)\right)}{0 - \sqrt[3]{a}} \]
    4. remove-double-negN/A

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

      \[\leadsto \frac{\sqrt[3]{g}}{\sqrt[3]{{\left(0 - \sqrt[3]{a}\right)}^{3}}} \]
    6. cbrt-divN/A

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

      \[\leadsto \sqrt[3]{\frac{g}{{\left(\mathsf{neg}\left(\sqrt[3]{a}\right)\right)}^{3}}} \]
    8. cube-negN/A

      \[\leadsto \sqrt[3]{\frac{g}{\mathsf{neg}\left({\left(\sqrt[3]{a}\right)}^{3}\right)}} \]
    9. rem-cube-cbrtN/A

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

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

      \[\leadsto \sqrt[3]{\frac{g}{\mathsf{neg}\left(a\right)}} \]
    12. rem-cube-cbrtN/A

      \[\leadsto \sqrt[3]{\frac{g}{\mathsf{neg}\left({\left(\sqrt[3]{a}\right)}^{3}\right)}} \]
    13. cube-negN/A

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

      \[\leadsto \sqrt[3]{\frac{g}{{\left(0 - \sqrt[3]{a}\right)}^{3}}} \]
    15. frac-2negN/A

      \[\leadsto \sqrt[3]{\frac{\mathsf{neg}\left(g\right)}{\mathsf{neg}\left({\left(0 - \sqrt[3]{a}\right)}^{3}\right)}} \]
    16. cbrt-divN/A

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

      \[\leadsto \frac{\sqrt[3]{\mathsf{neg}\left(g\right)}}{\sqrt[3]{{\left(\mathsf{neg}\left(\left(0 - \sqrt[3]{a}\right)\right)\right)}^{3}}} \]
    18. sub0-negN/A

      \[\leadsto \frac{\sqrt[3]{\mathsf{neg}\left(g\right)}}{\sqrt[3]{{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\sqrt[3]{a}\right)\right)\right)\right)}^{3}}} \]
    19. remove-double-negN/A

      \[\leadsto \frac{\sqrt[3]{\mathsf{neg}\left(g\right)}}{\sqrt[3]{{\left(\sqrt[3]{a}\right)}^{3}}} \]
  11. Applied egg-rr1.4%

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

Reproduce

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