2-ancestry mixing, positive discriminant

Percentage Accurate: 44.0% → 97.7%
Time: 11.0s
Alternatives: 9
Speedup: 0.9×

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: 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: 97.7% accurate, 0.4× speedup?

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

\\
\mathsf{fma}\left(\frac{\sqrt[3]{2 \cdot g}}{\sqrt[3]{a}}, \sqrt[3]{-0.5}, \frac{\sqrt[3]{\frac{h}{g} \cdot h}}{\sqrt[3]{a}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-0.5}\right)\right)
\end{array}
Derivation
  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 h around 0

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{2}, \sqrt[3]{\frac{-1}{2}}, \sqrt[3]{\frac{h \cdot h}{\color{blue}{g \cdot a}}} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{\frac{1}{2}}\right)\right) \]
    13. times-fracN/A

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{2}, \sqrt[3]{\frac{-1}{2}}, \sqrt[3]{\frac{h}{g} \cdot \frac{h}{a}} \cdot \color{blue}{\left(\sqrt[3]{\frac{1}{2}} \cdot \sqrt[3]{\frac{-1}{2}}\right)}\right) \]
  5. Applied rewrites74.2%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{2}, \sqrt[3]{-0.5}, \sqrt[3]{\frac{h}{g} \cdot \frac{h}{a}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-0.5}\right)\right)} \]
  6. Step-by-step derivation
    1. Applied rewrites92.8%

      \[\leadsto \mathsf{fma}\left(\left(\sqrt[3]{g} \cdot \frac{1}{\sqrt[3]{a}}\right) \cdot \sqrt[3]{2}, \sqrt[3]{-0.5}, \sqrt[3]{\frac{h}{g} \cdot \frac{h}{a}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-0.5}\right)\right) \]
    2. Step-by-step derivation
      1. Applied rewrites97.6%

        \[\leadsto \mathsf{fma}\left(\left(\sqrt[3]{g} \cdot \frac{1}{\sqrt[3]{a}}\right) \cdot \sqrt[3]{2}, \sqrt[3]{-0.5}, \frac{\sqrt[3]{\frac{h}{g} \cdot h}}{\sqrt[3]{a}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-0.5}\right)\right) \]
      2. Step-by-step derivation
        1. Applied rewrites98.3%

          \[\leadsto \mathsf{fma}\left(\frac{\sqrt[3]{2 \cdot g}}{\sqrt[3]{a}}, \sqrt[3]{\color{blue}{-0.5}}, \frac{\sqrt[3]{\frac{h}{g} \cdot h}}{\sqrt[3]{a}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-0.5}\right)\right) \]
        2. Add Preprocessing

        Alternative 2: 32.2% accurate, 0.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{g \cdot g - h \cdot h}\\ t_1 := \sqrt[3]{\frac{-g}{a}}\\ t_2 := {\left(2 \cdot a\right)}^{-1}\\ \mathbf{if}\;\sqrt[3]{t\_2 \cdot \left(\left(-g\right) + t\_0\right)} + \sqrt[3]{\frac{-1}{2 \cdot a} \cdot \left(g + t\_0\right)} \leq 5 \cdot 10^{+99}:\\ \;\;\;\;\sqrt[3]{\left(\sqrt{\left(h + g\right) \cdot \left(g - h\right)} - g\right) \cdot \frac{0.5}{a}} + t\_1\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{t\_2 \cdot \left(-2 \cdot g\right)} + t\_1\\ \end{array} \end{array} \]
        (FPCore (g h a)
         :precision binary64
         (let* ((t_0 (sqrt (- (* g g) (* h h))))
                (t_1 (cbrt (/ (- g) a)))
                (t_2 (pow (* 2.0 a) -1.0)))
           (if (<=
                (+
                 (cbrt (* t_2 (+ (- g) t_0)))
                 (cbrt (* (/ -1.0 (* 2.0 a)) (+ g t_0))))
                5e+99)
             (+ (cbrt (* (- (sqrt (* (+ h g) (- g h))) g) (/ 0.5 a))) t_1)
             (+ (cbrt (* t_2 (* -2.0 g))) t_1))))
        double code(double g, double h, double a) {
        	double t_0 = sqrt(((g * g) - (h * h)));
        	double t_1 = cbrt((-g / a));
        	double t_2 = pow((2.0 * a), -1.0);
        	double tmp;
        	if ((cbrt((t_2 * (-g + t_0))) + cbrt(((-1.0 / (2.0 * a)) * (g + t_0)))) <= 5e+99) {
        		tmp = cbrt(((sqrt(((h + g) * (g - h))) - g) * (0.5 / a))) + t_1;
        	} else {
        		tmp = cbrt((t_2 * (-2.0 * g))) + t_1;
        	}
        	return tmp;
        }
        
        public static double code(double g, double h, double a) {
        	double t_0 = Math.sqrt(((g * g) - (h * h)));
        	double t_1 = Math.cbrt((-g / a));
        	double t_2 = Math.pow((2.0 * a), -1.0);
        	double tmp;
        	if ((Math.cbrt((t_2 * (-g + t_0))) + Math.cbrt(((-1.0 / (2.0 * a)) * (g + t_0)))) <= 5e+99) {
        		tmp = Math.cbrt(((Math.sqrt(((h + g) * (g - h))) - g) * (0.5 / a))) + t_1;
        	} else {
        		tmp = Math.cbrt((t_2 * (-2.0 * g))) + t_1;
        	}
        	return tmp;
        }
        
        function code(g, h, a)
        	t_0 = sqrt(Float64(Float64(g * g) - Float64(h * h)))
        	t_1 = cbrt(Float64(Float64(-g) / a))
        	t_2 = Float64(2.0 * a) ^ -1.0
        	tmp = 0.0
        	if (Float64(cbrt(Float64(t_2 * Float64(Float64(-g) + t_0))) + cbrt(Float64(Float64(-1.0 / Float64(2.0 * a)) * Float64(g + t_0)))) <= 5e+99)
        		tmp = Float64(cbrt(Float64(Float64(sqrt(Float64(Float64(h + g) * Float64(g - h))) - g) * Float64(0.5 / a))) + t_1);
        	else
        		tmp = Float64(cbrt(Float64(t_2 * Float64(-2.0 * g))) + t_1);
        	end
        	return tmp
        end
        
        code[g_, h_, a_] := Block[{t$95$0 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(2.0 * a), $MachinePrecision], -1.0], $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(t$95$2 * N[((-g) + t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(-1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * N[(g + t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 5e+99], N[(N[Power[N[(N[(N[Sqrt[N[(N[(h + g), $MachinePrecision] * N[(g - h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - g), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[Power[N[(t$95$2 * N[(-2.0 * g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + t$95$1), $MachinePrecision]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \sqrt{g \cdot g - h \cdot h}\\
        t_1 := \sqrt[3]{\frac{-g}{a}}\\
        t_2 := {\left(2 \cdot a\right)}^{-1}\\
        \mathbf{if}\;\sqrt[3]{t\_2 \cdot \left(\left(-g\right) + t\_0\right)} + \sqrt[3]{\frac{-1}{2 \cdot a} \cdot \left(g + t\_0\right)} \leq 5 \cdot 10^{+99}:\\
        \;\;\;\;\sqrt[3]{\left(\sqrt{\left(h + g\right) \cdot \left(g - h\right)} - g\right) \cdot \frac{0.5}{a}} + t\_1\\
        
        \mathbf{else}:\\
        \;\;\;\;\sqrt[3]{t\_2 \cdot \left(-2 \cdot g\right)} + t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (+.f64 (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) < 5.00000000000000008e99

          1. Initial program 82.7%

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

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

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

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

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

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

            \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{\frac{-g}{a}}} \]
          6. Step-by-step derivation
            1. Applied rewrites49.3%

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

            if 5.00000000000000008e99 < (+.f64 (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))))

            1. Initial program 0.2%

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

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

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

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

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

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

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

              \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(-2 \cdot g\right)}} + \sqrt[3]{\frac{-g}{a}} \]
            7. Step-by-step derivation
              1. lower-*.f6413.0

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

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

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

          Alternative 3: 96.0% accurate, 0.6× speedup?

          \[\begin{array}{l} \\ \mathsf{fma}\left({\left(\sqrt[3]{a}\right)}^{-1}, \sqrt[3]{g} \cdot \sqrt[3]{-1}, \sqrt[3]{-0.25 \cdot \frac{\frac{h}{g} \cdot h}{a}}\right) \end{array} \]
          (FPCore (g h a)
           :precision binary64
           (fma
            (pow (cbrt a) -1.0)
            (* (cbrt g) (cbrt -1.0))
            (cbrt (* -0.25 (/ (* (/ h g) h) a)))))
          double code(double g, double h, double a) {
          	return fma(pow(cbrt(a), -1.0), (cbrt(g) * cbrt(-1.0)), cbrt((-0.25 * (((h / g) * h) / a))));
          }
          
          function code(g, h, a)
          	return fma((cbrt(a) ^ -1.0), Float64(cbrt(g) * cbrt(-1.0)), cbrt(Float64(-0.25 * Float64(Float64(Float64(h / g) * h) / a))))
          end
          
          code[g_, h_, a_] := N[(N[Power[N[Power[a, 1/3], $MachinePrecision], -1.0], $MachinePrecision] * N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[-1.0, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[(-0.25 * N[(N[(N[(h / g), $MachinePrecision] * h), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \mathsf{fma}\left({\left(\sqrt[3]{a}\right)}^{-1}, \sqrt[3]{g} \cdot \sqrt[3]{-1}, \sqrt[3]{-0.25 \cdot \frac{\frac{h}{g} \cdot h}{a}}\right)
          \end{array}
          
          Derivation
          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 h around 0

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{2}, \sqrt[3]{\frac{-1}{2}}, \sqrt[3]{\frac{h \cdot h}{\color{blue}{g \cdot a}}} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{\frac{1}{2}}\right)\right) \]
            13. times-fracN/A

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{2}, \sqrt[3]{\frac{-1}{2}}, \sqrt[3]{\frac{h}{g} \cdot \frac{h}{a}} \cdot \color{blue}{\left(\sqrt[3]{\frac{1}{2}} \cdot \sqrt[3]{\frac{-1}{2}}\right)}\right) \]
          5. Applied rewrites74.2%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{2}, \sqrt[3]{-0.5}, \sqrt[3]{\frac{h}{g} \cdot \frac{h}{a}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-0.5}\right)\right)} \]
          6. Step-by-step derivation
            1. Applied rewrites92.8%

              \[\leadsto \mathsf{fma}\left(\left(\sqrt[3]{g} \cdot \frac{1}{\sqrt[3]{a}}\right) \cdot \sqrt[3]{2}, \sqrt[3]{-0.5}, \sqrt[3]{\frac{h}{g} \cdot \frac{h}{a}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-0.5}\right)\right) \]
            2. Step-by-step derivation
              1. Applied rewrites97.6%

                \[\leadsto \mathsf{fma}\left(\left(\sqrt[3]{g} \cdot \frac{1}{\sqrt[3]{a}}\right) \cdot \sqrt[3]{2}, \sqrt[3]{-0.5}, \frac{\sqrt[3]{\frac{h}{g} \cdot h}}{\sqrt[3]{a}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-0.5}\right)\right) \]
              2. Step-by-step derivation
                1. Applied rewrites96.9%

                  \[\leadsto \mathsf{fma}\left({\left(\sqrt[3]{a}\right)}^{-1}, \color{blue}{\sqrt[3]{g} \cdot \sqrt[3]{-1}}, \sqrt[3]{-0.25 \cdot \frac{\frac{h}{g} \cdot h}{a}}\right) \]
                2. Add Preprocessing

                Alternative 4: 74.6% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if 2e288 < (*.f64 h h)

                  1. Initial program 0.0%

                    \[\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 h around 0

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{2}, \sqrt[3]{\frac{-1}{2}}, \sqrt[3]{\frac{h \cdot h}{\color{blue}{g \cdot a}}} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{\frac{1}{2}}\right)\right) \]
                    13. times-fracN/A

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{2}, \sqrt[3]{\frac{-1}{2}}, \sqrt[3]{\frac{h}{g} \cdot \frac{h}{a}} \cdot \color{blue}{\left(\sqrt[3]{\frac{1}{2}} \cdot \sqrt[3]{\frac{-1}{2}}\right)}\right) \]
                  5. Applied rewrites48.7%

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

                    \[\leadsto \sqrt[3]{\frac{g}{a}} \cdot \color{blue}{\left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{2}\right)} \]
                  7. Step-by-step derivation
                    1. Applied rewrites47.6%

                      \[\leadsto \left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{-0.5}\right) \cdot \color{blue}{\sqrt[3]{2}} \]
                  8. Recombined 2 regimes into one program.
                  9. Final simplification75.0%

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

                  Alternative 5: 75.2% accurate, 0.9× speedup?

                  \[\begin{array}{l} \\ \mathsf{fma}\left(\sqrt[3]{\frac{g}{a}}, \sqrt[3]{-1}, \sqrt[3]{-0.25 \cdot \left(\frac{h}{a} \cdot \frac{h}{g}\right)}\right) \end{array} \]
                  (FPCore (g h a)
                   :precision binary64
                   (fma (cbrt (/ g a)) (cbrt -1.0) (cbrt (* -0.25 (* (/ h a) (/ h g))))))
                  double code(double g, double h, double a) {
                  	return fma(cbrt((g / a)), cbrt(-1.0), cbrt((-0.25 * ((h / a) * (h / g)))));
                  }
                  
                  function code(g, h, a)
                  	return fma(cbrt(Float64(g / a)), cbrt(-1.0), cbrt(Float64(-0.25 * Float64(Float64(h / a) * Float64(h / g)))))
                  end
                  
                  code[g_, h_, a_] := N[(N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[-1.0, 1/3], $MachinePrecision] + N[Power[N[(-0.25 * N[(N[(h / a), $MachinePrecision] * N[(h / g), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  \mathsf{fma}\left(\sqrt[3]{\frac{g}{a}}, \sqrt[3]{-1}, \sqrt[3]{-0.25 \cdot \left(\frac{h}{a} \cdot \frac{h}{g}\right)}\right)
                  \end{array}
                  
                  Derivation
                  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 h around 0

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{2}, \sqrt[3]{\frac{-1}{2}}, \sqrt[3]{\frac{h \cdot h}{\color{blue}{g \cdot a}}} \cdot \left(\sqrt[3]{\frac{-1}{2}} \cdot \sqrt[3]{\frac{1}{2}}\right)\right) \]
                    13. times-fracN/A

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{2}, \sqrt[3]{\frac{-1}{2}}, \sqrt[3]{\frac{h}{g} \cdot \frac{h}{a}} \cdot \color{blue}{\left(\sqrt[3]{\frac{1}{2}} \cdot \sqrt[3]{\frac{-1}{2}}\right)}\right) \]
                  5. Applied rewrites74.2%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{2}, \sqrt[3]{-0.5}, \sqrt[3]{\frac{h}{g} \cdot \frac{h}{a}} \cdot \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-0.5}\right)\right)} \]
                  6. Step-by-step derivation
                    1. Applied rewrites75.0%

                      \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{g}{a}}, \color{blue}{\sqrt[3]{-1}}, \sqrt[3]{-0.25 \cdot \left(\frac{h}{a} \cdot \frac{h}{g}\right)}\right) \]
                    2. Add Preprocessing

                    Alternative 6: 71.6% accurate, 0.9× speedup?

                    \[\begin{array}{l} \\ \sqrt[3]{{\left(2 \cdot a\right)}^{-1} \cdot \left(-0.5 \cdot \frac{h \cdot h}{g}\right)} + \sqrt[3]{\frac{-g}{a}} \end{array} \]
                    (FPCore (g h a)
                     :precision binary64
                     (+ (cbrt (* (pow (* 2.0 a) -1.0) (* -0.5 (/ (* h h) g)))) (cbrt (/ (- g) a))))
                    double code(double g, double h, double a) {
                    	return cbrt((pow((2.0 * a), -1.0) * (-0.5 * ((h * h) / g)))) + cbrt((-g / a));
                    }
                    
                    public static double code(double g, double h, double a) {
                    	return Math.cbrt((Math.pow((2.0 * a), -1.0) * (-0.5 * ((h * h) / g)))) + Math.cbrt((-g / a));
                    }
                    
                    function code(g, h, a)
                    	return Float64(cbrt(Float64((Float64(2.0 * a) ^ -1.0) * Float64(-0.5 * Float64(Float64(h * h) / g)))) + cbrt(Float64(Float64(-g) / a)))
                    end
                    
                    code[g_, h_, a_] := N[(N[Power[N[(N[Power[N[(2.0 * a), $MachinePrecision], -1.0], $MachinePrecision] * N[(-0.5 * N[(N[(h * h), $MachinePrecision] / g), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    \sqrt[3]{{\left(2 \cdot a\right)}^{-1} \cdot \left(-0.5 \cdot \frac{h \cdot h}{g}\right)} + \sqrt[3]{\frac{-g}{a}}
                    \end{array}
                    
                    Derivation
                    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(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
                    4. Step-by-step derivation
                      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 7: 95.9% accurate, 0.9× speedup?

                    \[\begin{array}{l} \\ \mathsf{fma}\left(\sqrt[3]{\frac{0.5}{a}}, -\sqrt[3]{g \cdot 2}, \sqrt[3]{0 \cdot \frac{0.5}{a}}\right) \end{array} \]
                    (FPCore (g h a)
                     :precision binary64
                     (fma (cbrt (/ 0.5 a)) (- (cbrt (* g 2.0))) (cbrt (* 0.0 (/ 0.5 a)))))
                    double code(double g, double h, double a) {
                    	return fma(cbrt((0.5 / a)), -cbrt((g * 2.0)), cbrt((0.0 * (0.5 / a))));
                    }
                    
                    function code(g, h, a)
                    	return fma(cbrt(Float64(0.5 / a)), Float64(-cbrt(Float64(g * 2.0))), cbrt(Float64(0.0 * Float64(0.5 / a))))
                    end
                    
                    code[g_, h_, a_] := N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * (-N[Power[N[(g * 2.0), $MachinePrecision], 1/3], $MachinePrecision]) + N[Power[N[(0.0 * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    \mathsf{fma}\left(\sqrt[3]{\frac{0.5}{a}}, -\sqrt[3]{g \cdot 2}, \sqrt[3]{0 \cdot \frac{0.5}{a}}\right)
                    \end{array}
                    
                    Derivation
                    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. Step-by-step derivation
                      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{0.5}{a}}, -\sqrt[3]{\color{blue}{g \cdot 2}}, \sqrt[3]{\left(\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g\right) \cdot \frac{0.5}{a}}\right) \]
                    7. Applied rewrites32.9%

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{\frac{1}{2}}{a}}, -\sqrt[3]{g \cdot 2}, \sqrt[3]{\left(\frac{1}{2} \cdot \left(\color{blue}{0} \cdot h\right)\right) \cdot \frac{\frac{1}{2}}{a}}\right) \]
                      4. lower-*.f6496.8

                        \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{0.5}{a}}, -\sqrt[3]{g \cdot 2}, \sqrt[3]{\left(0.5 \cdot \color{blue}{\left(0 \cdot h\right)}\right) \cdot \frac{0.5}{a}}\right) \]
                    10. Applied rewrites96.8%

                      \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{0.5}{a}}, -\sqrt[3]{g \cdot 2}, \sqrt[3]{\color{blue}{\left(0.5 \cdot \left(0 \cdot h\right)\right)} \cdot \frac{0.5}{a}}\right) \]
                    11. Final simplification96.8%

                      \[\leadsto \mathsf{fma}\left(\sqrt[3]{\frac{0.5}{a}}, -\sqrt[3]{g \cdot 2}, \sqrt[3]{0 \cdot \frac{0.5}{a}}\right) \]
                    12. Add Preprocessing

                    Alternative 8: 15.3% accurate, 0.9× speedup?

                    \[\begin{array}{l} \\ \sqrt[3]{{\left(2 \cdot a\right)}^{-1} \cdot \left(-2 \cdot g\right)} + \sqrt[3]{\frac{-g}{a}} \end{array} \]
                    (FPCore (g h a)
                     :precision binary64
                     (+ (cbrt (* (pow (* 2.0 a) -1.0) (* -2.0 g))) (cbrt (/ (- g) a))))
                    double code(double g, double h, double a) {
                    	return cbrt((pow((2.0 * a), -1.0) * (-2.0 * g))) + cbrt((-g / a));
                    }
                    
                    public static double code(double g, double h, double a) {
                    	return Math.cbrt((Math.pow((2.0 * a), -1.0) * (-2.0 * g))) + Math.cbrt((-g / a));
                    }
                    
                    function code(g, h, a)
                    	return Float64(cbrt(Float64((Float64(2.0 * a) ^ -1.0) * Float64(-2.0 * g))) + cbrt(Float64(Float64(-g) / a)))
                    end
                    
                    code[g_, h_, a_] := N[(N[Power[N[(N[Power[N[(2.0 * a), $MachinePrecision], -1.0], $MachinePrecision] * N[(-2.0 * g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    \sqrt[3]{{\left(2 \cdot a\right)}^{-1} \cdot \left(-2 \cdot g\right)} + \sqrt[3]{\frac{-g}{a}}
                    \end{array}
                    
                    Derivation
                    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(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\color{blue}{-1 \cdot \frac{g}{a}}} \]
                    4. Step-by-step derivation
                      1. associate-*r/N/A

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

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

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

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

                      \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \color{blue}{\left(-2 \cdot g\right)}} + \sqrt[3]{\frac{-g}{a}} \]
                    7. Step-by-step derivation
                      1. lower-*.f6415.2

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

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

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

                    Alternative 9: 3.0% accurate, 302.0× speedup?

                    \[\begin{array}{l} \\ 0 \end{array} \]
                    (FPCore (g h a) :precision binary64 0.0)
                    double code(double g, double h, double a) {
                    	return 0.0;
                    }
                    
                    real(8) function code(g, h, a)
                        real(8), intent (in) :: g
                        real(8), intent (in) :: h
                        real(8), intent (in) :: a
                        code = 0.0d0
                    end function
                    
                    public static double code(double g, double h, double a) {
                    	return 0.0;
                    }
                    
                    def code(g, h, a):
                    	return 0.0
                    
                    function code(g, h, a)
                    	return 0.0
                    end
                    
                    function tmp = code(g, h, a)
                    	tmp = 0.0;
                    end
                    
                    code[g_, h_, a_] := 0.0
                    
                    \begin{array}{l}
                    
                    \\
                    0
                    \end{array}
                    
                    Derivation
                    1. Initial program 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. Step-by-step derivation
                      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \sqrt[3]{\frac{1}{2 \cdot a} \cdot \mathsf{fma}\left(\sqrt{g - h}, \sqrt{\color{blue}{h + g}}, -g\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)} \]
                      18. lower-+.f6412.2

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{0} \]
                    9. Add Preprocessing

                    Reproduce

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