
(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:
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (g h a)
:precision binary64
(let* ((t_0 (sqrt (- (* g g) (* h h))))
(t_1 (- t_0 g))
(t_2
(+
(cbrt (* (/ 1.0 (* 2.0 a)) t_1))
(cbrt (* (+ g t_0) (/ -1.0 (* 2.0 a)))))))
(if (or (<= t_2 -5e-100) (not (<= t_2 0.0)))
(+
(cbrt (* (+ g g) (/ (- 0.5) a)))
(cbrt (* (* 0.5 (/ h (/ g h))) (/ -0.5 a))))
(-
(cbrt (* t_1 (/ 0.5 a)))
(* (* (cbrt -0.5) (cbrt 2.0)) (/ (cbrt g) (- (cbrt a))))))))
double code(double g, double h, double a) {
double t_0 = sqrt(((g * g) - (h * h)));
double t_1 = t_0 - g;
double t_2 = cbrt(((1.0 / (2.0 * a)) * t_1)) + cbrt(((g + t_0) * (-1.0 / (2.0 * a))));
double tmp;
if ((t_2 <= -5e-100) || !(t_2 <= 0.0)) {
tmp = cbrt(((g + g) * (-0.5 / a))) + cbrt(((0.5 * (h / (g / h))) * (-0.5 / a)));
} else {
tmp = cbrt((t_1 * (0.5 / a))) - ((cbrt(-0.5) * cbrt(2.0)) * (cbrt(g) / -cbrt(a)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.sqrt(((g * g) - (h * h)));
double t_1 = t_0 - g;
double t_2 = Math.cbrt(((1.0 / (2.0 * a)) * t_1)) + Math.cbrt(((g + t_0) * (-1.0 / (2.0 * a))));
double tmp;
if ((t_2 <= -5e-100) || !(t_2 <= 0.0)) {
tmp = Math.cbrt(((g + g) * (-0.5 / a))) + Math.cbrt(((0.5 * (h / (g / h))) * (-0.5 / a)));
} else {
tmp = Math.cbrt((t_1 * (0.5 / a))) - ((Math.cbrt(-0.5) * Math.cbrt(2.0)) * (Math.cbrt(g) / -Math.cbrt(a)));
}
return tmp;
}
function code(g, h, a) t_0 = sqrt(Float64(Float64(g * g) - Float64(h * h))) t_1 = Float64(t_0 - g) t_2 = Float64(cbrt(Float64(Float64(1.0 / Float64(2.0 * a)) * t_1)) + cbrt(Float64(Float64(g + t_0) * Float64(-1.0 / Float64(2.0 * a))))) tmp = 0.0 if ((t_2 <= -5e-100) || !(t_2 <= 0.0)) tmp = Float64(cbrt(Float64(Float64(g + g) * Float64(Float64(-0.5) / a))) + cbrt(Float64(Float64(0.5 * Float64(h / Float64(g / h))) * Float64(-0.5 / a)))); else tmp = Float64(cbrt(Float64(t_1 * Float64(0.5 / a))) - Float64(Float64(cbrt(-0.5) * cbrt(2.0)) * Float64(cbrt(g) / Float64(-cbrt(a))))); 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[(t$95$0 - g), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(g + t$95$0), $MachinePrecision] * N[(-1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -5e-100], N[Not[LessEqual[t$95$2, 0.0]], $MachinePrecision]], N[(N[Power[N[(N[(g + g), $MachinePrecision] * N[((-0.5) / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(0.5 * N[(h / N[(g / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(t$95$1 * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] - N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[Power[g, 1/3], $MachinePrecision] / (-N[Power[a, 1/3], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{g \cdot g - h \cdot h}\\
t_1 := t_0 - g\\
t_2 := \sqrt[3]{\frac{1}{2 \cdot a} \cdot t_1} + \sqrt[3]{\left(g + t_0\right) \cdot \frac{-1}{2 \cdot a}}\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{-100} \lor \neg \left(t_2 \leq 0\right):\\
\;\;\;\;\sqrt[3]{\left(g + g\right) \cdot \frac{-0.5}{a}} + \sqrt[3]{\left(0.5 \cdot \frac{h}{\frac{g}{h}}\right) \cdot \frac{-0.5}{a}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{t_1 \cdot \frac{0.5}{a}} - \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right) \cdot \frac{\sqrt[3]{g}}{-\sqrt[3]{a}}\\
\end{array}
\end{array}
if (+.f64 (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) < -5.0000000000000001e-100 or 0.0 < (+.f64 (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) Initial program 44.9%
Simplified44.9%
Taylor expanded in g around -inf 27.7%
mul-1-neg27.7%
Simplified27.7%
Taylor expanded in g around -inf 73.5%
unpow273.5%
associate-/l*76.6%
Simplified76.6%
if -5.0000000000000001e-100 < (+.f64 (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) < 0.0Initial program 18.9%
Simplified26.8%
Taylor expanded in h around 0 18.0%
unpow1/320.4%
*-lft-identity20.4%
Simplified20.4%
cbrt-div92.2%
frac-2neg92.2%
Applied egg-rr92.2%
Final simplification77.4%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (sqrt (- (* g g) (* h h))))
(t_1 (- t_0 g))
(t_2
(+
(cbrt (* (/ 1.0 (* 2.0 a)) t_1))
(cbrt (* (+ g t_0) (/ -1.0 (* 2.0 a)))))))
(if (or (<= t_2 -5e-100) (not (<= t_2 0.0)))
(+
(cbrt (* (+ g g) (/ (- 0.5) a)))
(cbrt (* (* 0.5 (/ h (/ g h))) (/ -0.5 a))))
(+
(cbrt (* t_1 (/ 0.5 a)))
(* (* (cbrt -0.5) (cbrt 2.0)) (* (cbrt g) (cbrt (/ 1.0 a))))))))
double code(double g, double h, double a) {
double t_0 = sqrt(((g * g) - (h * h)));
double t_1 = t_0 - g;
double t_2 = cbrt(((1.0 / (2.0 * a)) * t_1)) + cbrt(((g + t_0) * (-1.0 / (2.0 * a))));
double tmp;
if ((t_2 <= -5e-100) || !(t_2 <= 0.0)) {
tmp = cbrt(((g + g) * (-0.5 / a))) + cbrt(((0.5 * (h / (g / h))) * (-0.5 / a)));
} else {
tmp = cbrt((t_1 * (0.5 / a))) + ((cbrt(-0.5) * cbrt(2.0)) * (cbrt(g) * cbrt((1.0 / a))));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.sqrt(((g * g) - (h * h)));
double t_1 = t_0 - g;
double t_2 = Math.cbrt(((1.0 / (2.0 * a)) * t_1)) + Math.cbrt(((g + t_0) * (-1.0 / (2.0 * a))));
double tmp;
if ((t_2 <= -5e-100) || !(t_2 <= 0.0)) {
tmp = Math.cbrt(((g + g) * (-0.5 / a))) + Math.cbrt(((0.5 * (h / (g / h))) * (-0.5 / a)));
} else {
tmp = Math.cbrt((t_1 * (0.5 / a))) + ((Math.cbrt(-0.5) * Math.cbrt(2.0)) * (Math.cbrt(g) * Math.cbrt((1.0 / a))));
}
return tmp;
}
function code(g, h, a) t_0 = sqrt(Float64(Float64(g * g) - Float64(h * h))) t_1 = Float64(t_0 - g) t_2 = Float64(cbrt(Float64(Float64(1.0 / Float64(2.0 * a)) * t_1)) + cbrt(Float64(Float64(g + t_0) * Float64(-1.0 / Float64(2.0 * a))))) tmp = 0.0 if ((t_2 <= -5e-100) || !(t_2 <= 0.0)) tmp = Float64(cbrt(Float64(Float64(g + g) * Float64(Float64(-0.5) / a))) + cbrt(Float64(Float64(0.5 * Float64(h / Float64(g / h))) * Float64(-0.5 / a)))); else tmp = Float64(cbrt(Float64(t_1 * Float64(0.5 / a))) + Float64(Float64(cbrt(-0.5) * cbrt(2.0)) * Float64(cbrt(g) * cbrt(Float64(1.0 / a))))); 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[(t$95$0 - g), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(g + t$95$0), $MachinePrecision] * N[(-1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -5e-100], N[Not[LessEqual[t$95$2, 0.0]], $MachinePrecision]], N[(N[Power[N[(N[(g + g), $MachinePrecision] * N[((-0.5) / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(0.5 * N[(h / N[(g / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(t$95$1 * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[N[(1.0 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{g \cdot g - h \cdot h}\\
t_1 := t_0 - g\\
t_2 := \sqrt[3]{\frac{1}{2 \cdot a} \cdot t_1} + \sqrt[3]{\left(g + t_0\right) \cdot \frac{-1}{2 \cdot a}}\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{-100} \lor \neg \left(t_2 \leq 0\right):\\
\;\;\;\;\sqrt[3]{\left(g + g\right) \cdot \frac{-0.5}{a}} + \sqrt[3]{\left(0.5 \cdot \frac{h}{\frac{g}{h}}\right) \cdot \frac{-0.5}{a}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{t_1 \cdot \frac{0.5}{a}} + \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right) \cdot \left(\sqrt[3]{g} \cdot \sqrt[3]{\frac{1}{a}}\right)\\
\end{array}
\end{array}
if (+.f64 (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) < -5.0000000000000001e-100 or 0.0 < (+.f64 (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) Initial program 44.9%
Simplified44.9%
Taylor expanded in g around -inf 27.7%
mul-1-neg27.7%
Simplified27.7%
Taylor expanded in g around -inf 73.5%
unpow273.5%
associate-/l*76.6%
Simplified76.6%
if -5.0000000000000001e-100 < (+.f64 (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) < 0.0Initial program 18.9%
Simplified26.8%
Taylor expanded in h around 0 18.0%
unpow1/320.4%
*-lft-identity20.4%
Simplified20.4%
div-inv20.4%
cbrt-prod92.2%
Applied egg-rr92.2%
Final simplification77.4%
(FPCore (g h a) :precision binary64 (+ (cbrt (* (+ g g) (/ (- 0.5) a))) (cbrt (* (* 0.5 (/ h (/ g h))) (/ -0.5 a)))))
double code(double g, double h, double a) {
return cbrt(((g + g) * (-0.5 / a))) + cbrt(((0.5 * (h / (g / h))) * (-0.5 / a)));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((g + g) * (-0.5 / a))) + Math.cbrt(((0.5 * (h / (g / h))) * (-0.5 / a)));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(g + g) * Float64(Float64(-0.5) / a))) + cbrt(Float64(Float64(0.5 * Float64(h / Float64(g / h))) * Float64(-0.5 / a)))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(g + g), $MachinePrecision] * N[((-0.5) / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(0.5 * N[(h / N[(g / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\left(g + g\right) \cdot \frac{-0.5}{a}} + \sqrt[3]{\left(0.5 \cdot \frac{h}{\frac{g}{h}}\right) \cdot \frac{-0.5}{a}}
\end{array}
Initial program 43.7%
Simplified44.1%
Taylor expanded in g around -inf 26.8%
mul-1-neg26.8%
Simplified26.8%
Taylor expanded in g around -inf 71.0%
unpow271.0%
associate-/l*74.0%
Simplified74.0%
Final simplification74.0%
(FPCore (g h a) :precision binary64 (+ (cbrt (* (+ g g) (/ (- 0.5) a))) (cbrt (* (/ -0.5 a) (+ g g)))))
double code(double g, double h, double a) {
return cbrt(((g + g) * (-0.5 / a))) + cbrt(((-0.5 / a) * (g + g)));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((g + g) * (-0.5 / a))) + Math.cbrt(((-0.5 / a) * (g + g)));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(g + g) * Float64(Float64(-0.5) / a))) + cbrt(Float64(Float64(-0.5 / a) * Float64(g + g)))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(g + g), $MachinePrecision] * N[((-0.5) / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\left(g + g\right) \cdot \frac{-0.5}{a}} + \sqrt[3]{\frac{-0.5}{a} \cdot \left(g + g\right)}
\end{array}
Initial program 43.7%
Simplified44.1%
Taylor expanded in g around -inf 26.8%
mul-1-neg26.8%
Simplified26.8%
Taylor expanded in g around inf 15.1%
Final simplification15.1%
(FPCore (g h a) :precision binary64 (+ (cbrt (* (+ g g) (/ (- 0.5) a))) (cbrt (* (/ -0.5 a) (- g g)))))
double code(double g, double h, double a) {
return cbrt(((g + g) * (-0.5 / a))) + cbrt(((-0.5 / a) * (g - g)));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((g + g) * (-0.5 / a))) + Math.cbrt(((-0.5 / a) * (g - g)));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(g + g) * Float64(Float64(-0.5) / a))) + cbrt(Float64(Float64(-0.5 / a) * Float64(g - g)))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(g + g), $MachinePrecision] * N[((-0.5) / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\left(g + g\right) \cdot \frac{-0.5}{a}} + \sqrt[3]{\frac{-0.5}{a} \cdot \left(g - g\right)}
\end{array}
Initial program 43.7%
Simplified44.1%
Taylor expanded in g around -inf 26.8%
mul-1-neg26.8%
Simplified26.8%
Taylor expanded in g around -inf 72.8%
mul-1-neg26.8%
Simplified72.8%
Final simplification72.8%
herbie shell --seed 2023274
(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))))))))