
(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 9 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 (+ (/ (cbrt (- g)) (cbrt a)) (cbrt (* (- g g) (/ -0.5 a)))))
double code(double g, double h, double a) {
return (cbrt(-g) / cbrt(a)) + cbrt(((g - g) * (-0.5 / a)));
}
public static double code(double g, double h, double a) {
return (Math.cbrt(-g) / Math.cbrt(a)) + Math.cbrt(((g - g) * (-0.5 / a)));
}
function code(g, h, a) return Float64(Float64(cbrt(Float64(-g)) / cbrt(a)) + cbrt(Float64(Float64(g - g) * Float64(-0.5 / a)))) end
code[g_, h_, a_] := N[(N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(g - g), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt[3]{-g}}{\sqrt[3]{a}} + \sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}}
\end{array}
Initial program 42.6%
Simplified42.6%
Taylor expanded in g around -inf 25.8%
*-commutative25.8%
Simplified25.8%
Taylor expanded in g around -inf 69.9%
neg-mul-169.9%
Simplified69.9%
associate-*l/69.9%
cbrt-div95.4%
*-commutative95.4%
associate-*r*95.8%
metadata-eval95.8%
neg-mul-195.8%
Applied egg-rr95.8%
Final simplification95.8%
(FPCore (g h a) :precision binary64 (if (or (<= a -1.6e-28) (not (<= a 2.05e-52))) (- (cbrt (* (- g g) (/ -0.5 a))) (cbrt (/ g a))) (+ (/ (cbrt (- g)) (cbrt a)) (cbrt -1.0))))
double code(double g, double h, double a) {
double tmp;
if ((a <= -1.6e-28) || !(a <= 2.05e-52)) {
tmp = cbrt(((g - g) * (-0.5 / a))) - cbrt((g / a));
} else {
tmp = (cbrt(-g) / cbrt(a)) + cbrt(-1.0);
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((a <= -1.6e-28) || !(a <= 2.05e-52)) {
tmp = Math.cbrt(((g - g) * (-0.5 / a))) - Math.cbrt((g / a));
} else {
tmp = (Math.cbrt(-g) / Math.cbrt(a)) + Math.cbrt(-1.0);
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((a <= -1.6e-28) || !(a <= 2.05e-52)) tmp = Float64(cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) - cbrt(Float64(g / a))); else tmp = Float64(Float64(cbrt(Float64(-g)) / cbrt(a)) + cbrt(-1.0)); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[a, -1.6e-28], N[Not[LessEqual[a, 2.05e-52]], $MachinePrecision]], N[(N[Power[N[(N[(g - g), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[-1.0, 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \cdot 10^{-28} \lor \neg \left(a \leq 2.05 \cdot 10^{-52}\right):\\
\;\;\;\;\sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}} - \sqrt[3]{\frac{g}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{-g}}{\sqrt[3]{a}} + \sqrt[3]{-1}\\
\end{array}
\end{array}
if a < -1.59999999999999991e-28 or 2.04999999999999994e-52 < a Initial program 47.3%
Simplified47.3%
Taylor expanded in g around -inf 27.0%
*-commutative27.0%
Simplified27.0%
Taylor expanded in g around -inf 84.1%
neg-mul-184.1%
Simplified84.1%
Taylor expanded in g around -inf 84.8%
mul-1-neg84.8%
Simplified84.8%
if -1.59999999999999991e-28 < a < 2.04999999999999994e-52Initial program 36.6%
Simplified36.6%
Taylor expanded in g around -inf 24.2%
*-commutative24.2%
Simplified24.2%
Taylor expanded in g around inf 11.8%
Applied egg-rr0.0%
Simplified46.5%
Applied egg-rr91.8%
Final simplification87.9%
(FPCore (g h a) :precision binary64 (if (or (<= a -1.4e-41) (not (<= a 2.8e-23))) (+ (cbrt (* (/ 0.5 a) (* g -2.0))) (/ -1.0 (cbrt a))) (+ (cbrt g) (cbrt (* (/ -0.5 a) (+ g g))))))
double code(double g, double h, double a) {
double tmp;
if ((a <= -1.4e-41) || !(a <= 2.8e-23)) {
tmp = cbrt(((0.5 / a) * (g * -2.0))) + (-1.0 / cbrt(a));
} else {
tmp = cbrt(g) + cbrt(((-0.5 / a) * (g + g)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((a <= -1.4e-41) || !(a <= 2.8e-23)) {
tmp = Math.cbrt(((0.5 / a) * (g * -2.0))) + (-1.0 / Math.cbrt(a));
} else {
tmp = Math.cbrt(g) + Math.cbrt(((-0.5 / a) * (g + g)));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((a <= -1.4e-41) || !(a <= 2.8e-23)) tmp = Float64(cbrt(Float64(Float64(0.5 / a) * Float64(g * -2.0))) + Float64(-1.0 / cbrt(a))); else tmp = Float64(cbrt(g) + cbrt(Float64(Float64(-0.5 / a) * Float64(g + g)))); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[a, -1.4e-41], N[Not[LessEqual[a, 2.8e-23]], $MachinePrecision]], N[(N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(g * -2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(-1.0 / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[g, 1/3], $MachinePrecision] + N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.4 \cdot 10^{-41} \lor \neg \left(a \leq 2.8 \cdot 10^{-23}\right):\\
\;\;\;\;\sqrt[3]{\frac{0.5}{a} \cdot \left(g \cdot -2\right)} + \frac{-1}{\sqrt[3]{a}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{g} + \sqrt[3]{\frac{-0.5}{a} \cdot \left(g + g\right)}\\
\end{array}
\end{array}
if a < -1.4000000000000001e-41 or 2.7999999999999997e-23 < a Initial program 45.9%
Simplified45.9%
Taylor expanded in g around -inf 26.4%
*-commutative26.4%
Simplified26.4%
Taylor expanded in g around inf 17.1%
Applied egg-rr0.0%
Simplified61.1%
if -1.4000000000000001e-41 < a < 2.7999999999999997e-23Initial program 38.6%
Simplified38.6%
Taylor expanded in g around -inf 25.0%
*-commutative25.0%
Simplified25.0%
Taylor expanded in g around inf 12.0%
Taylor expanded in a around 0 12.0%
Simplified52.1%
Final simplification57.1%
(FPCore (g h a) :precision binary64 (if (or (<= g -1.75e+41) (not (<= g 2.4e+21))) (+ (cbrt -1.0) (cbrt (/ g (- a)))) (- (cbrt (* (/ 0.5 a) (* g -2.0))) (cbrt g))))
double code(double g, double h, double a) {
double tmp;
if ((g <= -1.75e+41) || !(g <= 2.4e+21)) {
tmp = cbrt(-1.0) + cbrt((g / -a));
} else {
tmp = cbrt(((0.5 / a) * (g * -2.0))) - cbrt(g);
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((g <= -1.75e+41) || !(g <= 2.4e+21)) {
tmp = Math.cbrt(-1.0) + Math.cbrt((g / -a));
} else {
tmp = Math.cbrt(((0.5 / a) * (g * -2.0))) - Math.cbrt(g);
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((g <= -1.75e+41) || !(g <= 2.4e+21)) tmp = Float64(cbrt(-1.0) + cbrt(Float64(g / Float64(-a)))); else tmp = Float64(cbrt(Float64(Float64(0.5 / a) * Float64(g * -2.0))) - cbrt(g)); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[g, -1.75e+41], N[Not[LessEqual[g, 2.4e+21]], $MachinePrecision]], N[(N[Power[-1.0, 1/3], $MachinePrecision] + N[Power[N[(g / (-a)), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(g * -2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq -1.75 \cdot 10^{+41} \lor \neg \left(g \leq 2.4 \cdot 10^{+21}\right):\\
\;\;\;\;\sqrt[3]{-1} + \sqrt[3]{\frac{g}{-a}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{0.5}{a} \cdot \left(g \cdot -2\right)} - \sqrt[3]{g}\\
\end{array}
\end{array}
if g < -1.75e41 or 2.4e21 < g Initial program 28.4%
Simplified28.4%
Taylor expanded in g around -inf 18.7%
*-commutative18.7%
Simplified18.7%
Taylor expanded in g around inf 14.1%
Applied egg-rr0.0%
Simplified50.3%
Taylor expanded in g around 0 50.7%
associate-*r/50.7%
mul-1-neg50.7%
Simplified50.7%
if -1.75e41 < g < 2.4e21Initial program 70.2%
Simplified70.2%
Taylor expanded in g around -inf 39.6%
*-commutative39.6%
Simplified39.6%
Taylor expanded in g around inf 16.2%
Taylor expanded in g around 0 16.2%
Simplified34.6%
Final simplification45.2%
(FPCore (g h a) :precision binary64 (if (or (<= g -0.059) (not (<= g 9.0))) (+ (cbrt -1.0) (cbrt (/ g (- a)))) (+ (cbrt g) (cbrt (* (/ -0.5 a) (+ g g))))))
double code(double g, double h, double a) {
double tmp;
if ((g <= -0.059) || !(g <= 9.0)) {
tmp = cbrt(-1.0) + cbrt((g / -a));
} else {
tmp = cbrt(g) + cbrt(((-0.5 / a) * (g + g)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((g <= -0.059) || !(g <= 9.0)) {
tmp = Math.cbrt(-1.0) + Math.cbrt((g / -a));
} else {
tmp = Math.cbrt(g) + Math.cbrt(((-0.5 / a) * (g + g)));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((g <= -0.059) || !(g <= 9.0)) tmp = Float64(cbrt(-1.0) + cbrt(Float64(g / Float64(-a)))); else tmp = Float64(cbrt(g) + cbrt(Float64(Float64(-0.5 / a) * Float64(g + g)))); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[g, -0.059], N[Not[LessEqual[g, 9.0]], $MachinePrecision]], N[(N[Power[-1.0, 1/3], $MachinePrecision] + N[Power[N[(g / (-a)), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[g, 1/3], $MachinePrecision] + N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq -0.059 \lor \neg \left(g \leq 9\right):\\
\;\;\;\;\sqrt[3]{-1} + \sqrt[3]{\frac{g}{-a}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{g} + \sqrt[3]{\frac{-0.5}{a} \cdot \left(g + g\right)}\\
\end{array}
\end{array}
if g < -0.058999999999999997 or 9 < g Initial program 32.6%
Simplified32.6%
Taylor expanded in g around -inf 20.8%
*-commutative20.8%
Simplified20.8%
Taylor expanded in g around inf 14.3%
Applied egg-rr0.0%
Simplified49.9%
Taylor expanded in g around 0 50.3%
associate-*r/50.3%
mul-1-neg50.3%
Simplified50.3%
if -0.058999999999999997 < g < 9Initial program 66.9%
Simplified66.9%
Taylor expanded in g around -inf 37.8%
*-commutative37.8%
Simplified37.8%
Taylor expanded in g around inf 15.9%
Taylor expanded in a around 0 15.9%
Simplified32.9%
Final simplification45.2%
(FPCore (g h a) :precision binary64 (+ (cbrt (* (/ 0.5 a) (* g -2.0))) (cbrt (* (/ -0.5 a) 0.0))))
double code(double g, double h, double a) {
return cbrt(((0.5 / a) * (g * -2.0))) + cbrt(((-0.5 / a) * 0.0));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((0.5 / a) * (g * -2.0))) + Math.cbrt(((-0.5 / a) * 0.0));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(0.5 / a) * Float64(g * -2.0))) + cbrt(Float64(Float64(-0.5 / a) * 0.0))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(g * -2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(-0.5 / a), $MachinePrecision] * 0.0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{0.5}{a} \cdot \left(g \cdot -2\right)} + \sqrt[3]{\frac{-0.5}{a} \cdot 0}
\end{array}
Initial program 42.6%
Simplified42.6%
Taylor expanded in g around -inf 25.8%
*-commutative25.8%
Simplified25.8%
Taylor expanded in g around -inf 63.6%
associate-*r*63.6%
neg-mul-163.6%
Simplified63.6%
Taylor expanded in h around 0 69.9%
distribute-rgt1-in69.9%
metadata-eval69.9%
mul0-lft69.9%
Simplified69.9%
Final simplification69.9%
(FPCore (g h a) :precision binary64 (- (cbrt (* (- g g) (/ -0.5 a))) (cbrt (/ g a))))
double code(double g, double h, double a) {
return cbrt(((g - g) * (-0.5 / a))) - cbrt((g / a));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((g - g) * (-0.5 / a))) - Math.cbrt((g / a));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) - cbrt(Float64(g / 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[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}} - \sqrt[3]{\frac{g}{a}}
\end{array}
Initial program 42.6%
Simplified42.6%
Taylor expanded in g around -inf 25.8%
*-commutative25.8%
Simplified25.8%
Taylor expanded in g around -inf 69.9%
neg-mul-169.9%
Simplified69.9%
Taylor expanded in g around -inf 70.3%
mul-1-neg70.3%
Simplified70.3%
Final simplification70.3%
(FPCore (g h a) :precision binary64 (+ (cbrt -1.0) (cbrt (/ g (- a)))))
double code(double g, double h, double a) {
return cbrt(-1.0) + cbrt((g / -a));
}
public static double code(double g, double h, double a) {
return Math.cbrt(-1.0) + Math.cbrt((g / -a));
}
function code(g, h, a) return Float64(cbrt(-1.0) + cbrt(Float64(g / Float64(-a)))) end
code[g_, h_, a_] := N[(N[Power[-1.0, 1/3], $MachinePrecision] + N[Power[N[(g / (-a)), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{-1} + \sqrt[3]{\frac{g}{-a}}
\end{array}
Initial program 42.6%
Simplified42.6%
Taylor expanded in g around -inf 25.8%
*-commutative25.8%
Simplified25.8%
Taylor expanded in g around inf 14.8%
Applied egg-rr0.0%
Simplified41.8%
Taylor expanded in g around 0 42.0%
associate-*r/42.0%
mul-1-neg42.0%
Simplified42.0%
Final simplification42.0%
(FPCore (g h a) :precision binary64 (+ 1.0 (cbrt (* g (- a)))))
double code(double g, double h, double a) {
return 1.0 + cbrt((g * -a));
}
public static double code(double g, double h, double a) {
return 1.0 + Math.cbrt((g * -a));
}
function code(g, h, a) return Float64(1.0 + cbrt(Float64(g * Float64(-a)))) end
code[g_, h_, a_] := N[(1.0 + N[Power[N[(g * (-a)), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \sqrt[3]{g \cdot \left(-a\right)}
\end{array}
Initial program 42.6%
Simplified42.6%
Taylor expanded in g around -inf 25.8%
*-commutative25.8%
Simplified25.8%
Taylor expanded in g around inf 14.8%
Applied egg-rr0.0%
Simplified41.8%
Applied egg-rr3.4%
log1p-undefine3.4%
metadata-eval3.4%
fma-undefine3.4%
rem-exp-log5.4%
fma-undefine5.4%
metadata-eval5.4%
*-commutative5.4%
*-commutative5.4%
associate-*l*5.4%
associate-*r*5.4%
metadata-eval5.4%
mul-1-neg5.4%
Simplified5.4%
Final simplification5.4%
herbie shell --seed 2024102
(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))))))))