
(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 14 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 0.5) (cbrt (/ 1.0 a))) (cbrt (* g -2.0))) (cbrt (* (- g g) (/ -0.5 a)))))
double code(double g, double h, double a) {
return ((cbrt(0.5) * cbrt((1.0 / a))) * cbrt((g * -2.0))) + cbrt(((g - g) * (-0.5 / a)));
}
public static double code(double g, double h, double a) {
return ((Math.cbrt(0.5) * Math.cbrt((1.0 / a))) * Math.cbrt((g * -2.0))) + Math.cbrt(((g - g) * (-0.5 / a)));
}
function code(g, h, a) return Float64(Float64(Float64(cbrt(0.5) * cbrt(Float64(1.0 / a))) * cbrt(Float64(g * -2.0))) + cbrt(Float64(Float64(g - g) * Float64(-0.5 / a)))) end
code[g_, h_, a_] := N[(N[(N[(N[Power[0.5, 1/3], $MachinePrecision] * N[Power[N[(1.0 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[N[(g * -2.0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(g - g), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\sqrt[3]{0.5} \cdot \sqrt[3]{\frac{1}{a}}\right) \cdot \sqrt[3]{g \cdot -2} + \sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}}
\end{array}
(FPCore (g h a) :precision binary64 (+ (cbrt (* (- g g) (/ -0.5 a))) (* (cbrt (* g -2.0)) (cbrt (/ 0.5 a)))))
double code(double g, double h, double a) {
return cbrt(((g - g) * (-0.5 / a))) + (cbrt((g * -2.0)) * cbrt((0.5 / a)));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((g - g) * (-0.5 / a))) + (Math.cbrt((g * -2.0)) * Math.cbrt((0.5 / a)));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) + Float64(cbrt(Float64(g * -2.0)) * cbrt(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[(N[Power[N[(g * -2.0), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}} + \sqrt[3]{g \cdot -2} \cdot \sqrt[3]{\frac{0.5}{a}}
\end{array}
(FPCore (g h a) :precision binary64 (+ (cbrt (* (- g g) (/ -0.5 a))) (/ (cbrt (- g)) (cbrt a))))
double code(double g, double h, double a) {
return cbrt(((g - g) * (-0.5 / a))) + (cbrt(-g) / cbrt(a));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((g - g) * (-0.5 / a))) + (Math.cbrt(-g) / Math.cbrt(a));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) + Float64(cbrt(Float64(-g)) / cbrt(a))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(g - g), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}} + \frac{\sqrt[3]{-g}}{\sqrt[3]{a}}
\end{array}
(FPCore (g h a)
:precision binary64
(let* ((t_0 (cbrt (* (- g g) (/ -0.5 a)))))
(if (<= a -1.2e-82)
(+ t_0 (cbrt (- (/ g a))))
(if (<= a 5e-68)
(+ (/ (cbrt (- g)) (cbrt a)) (cbrt -2.0))
(+ t_0 (cbrt (* (* g -2.0) (/ 0.5 a))))))))
double code(double g, double h, double a) {
double t_0 = cbrt(((g - g) * (-0.5 / a)));
double tmp;
if (a <= -1.2e-82) {
tmp = t_0 + cbrt(-(g / a));
} else if (a <= 5e-68) {
tmp = (cbrt(-g) / cbrt(a)) + cbrt(-2.0);
} else {
tmp = t_0 + cbrt(((g * -2.0) * (0.5 / a)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.cbrt(((g - g) * (-0.5 / a)));
double tmp;
if (a <= -1.2e-82) {
tmp = t_0 + Math.cbrt(-(g / a));
} else if (a <= 5e-68) {
tmp = (Math.cbrt(-g) / Math.cbrt(a)) + Math.cbrt(-2.0);
} else {
tmp = t_0 + Math.cbrt(((g * -2.0) * (0.5 / a)));
}
return tmp;
}
function code(g, h, a) t_0 = cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) tmp = 0.0 if (a <= -1.2e-82) tmp = Float64(t_0 + cbrt(Float64(-Float64(g / a)))); elseif (a <= 5e-68) tmp = Float64(Float64(cbrt(Float64(-g)) / cbrt(a)) + cbrt(-2.0)); else tmp = Float64(t_0 + cbrt(Float64(Float64(g * -2.0) * Float64(0.5 / a)))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[Power[N[(N[(g - g), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[a, -1.2e-82], N[(t$95$0 + N[Power[(-N[(g / a), $MachinePrecision]), 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5e-68], N[(N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[-2.0, 1/3], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[Power[N[(N[(g * -2.0), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}}\\
\mathbf{if}\;a \leq -1.2 \cdot 10^{-82}:\\
\;\;\;\;t_0 + \sqrt[3]{-\frac{g}{a}}\\
\mathbf{elif}\;a \leq 5 \cdot 10^{-68}:\\
\;\;\;\;\frac{\sqrt[3]{-g}}{\sqrt[3]{a}} + \sqrt[3]{-2}\\
\mathbf{else}:\\
\;\;\;\;t_0 + \sqrt[3]{\left(g \cdot -2\right) \cdot \frac{0.5}{a}}\\
\end{array}
\end{array}
(FPCore (g h a) :precision binary64 (if (or (<= g -0.00142) (not (<= g 4e-9))) (+ (cbrt (/ -0.25 (* a g))) (cbrt (* (/ -0.5 a) (+ g g)))) (+ (cbrt (* (* g -2.0) (/ 0.5 a))) (/ (cbrt g) -2.0))))
double code(double g, double h, double a) {
double tmp;
if ((g <= -0.00142) || !(g <= 4e-9)) {
tmp = cbrt((-0.25 / (a * g))) + cbrt(((-0.5 / a) * (g + g)));
} else {
tmp = cbrt(((g * -2.0) * (0.5 / a))) + (cbrt(g) / -2.0);
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((g <= -0.00142) || !(g <= 4e-9)) {
tmp = Math.cbrt((-0.25 / (a * g))) + Math.cbrt(((-0.5 / a) * (g + g)));
} else {
tmp = Math.cbrt(((g * -2.0) * (0.5 / a))) + (Math.cbrt(g) / -2.0);
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((g <= -0.00142) || !(g <= 4e-9)) tmp = Float64(cbrt(Float64(-0.25 / Float64(a * g))) + cbrt(Float64(Float64(-0.5 / a) * Float64(g + g)))); else tmp = Float64(cbrt(Float64(Float64(g * -2.0) * Float64(0.5 / a))) + Float64(cbrt(g) / -2.0)); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[g, -0.00142], N[Not[LessEqual[g, 4e-9]], $MachinePrecision]], N[(N[Power[N[(-0.25 / N[(a * g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(g * -2.0), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[g, 1/3], $MachinePrecision] / -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq -0.00142 \lor \neg \left(g \leq 4 \cdot 10^{-9}\right):\\
\;\;\;\;\sqrt[3]{\frac{-0.25}{a \cdot g}} + \sqrt[3]{\frac{-0.5}{a} \cdot \left(g + g\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\left(g \cdot -2\right) \cdot \frac{0.5}{a}} + \frac{\sqrt[3]{g}}{-2}\\
\end{array}
\end{array}
(FPCore (g h a) :precision binary64 (if (or (<= g -120000000.0) (not (<= g 70.0))) (+ (cbrt (- (/ g a))) (cbrt -2.0)) (+ (cbrt (* (* g -2.0) (/ 0.5 a))) (/ (cbrt g) -2.0))))
double code(double g, double h, double a) {
double tmp;
if ((g <= -120000000.0) || !(g <= 70.0)) {
tmp = cbrt(-(g / a)) + cbrt(-2.0);
} else {
tmp = cbrt(((g * -2.0) * (0.5 / a))) + (cbrt(g) / -2.0);
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((g <= -120000000.0) || !(g <= 70.0)) {
tmp = Math.cbrt(-(g / a)) + Math.cbrt(-2.0);
} else {
tmp = Math.cbrt(((g * -2.0) * (0.5 / a))) + (Math.cbrt(g) / -2.0);
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((g <= -120000000.0) || !(g <= 70.0)) tmp = Float64(cbrt(Float64(-Float64(g / a))) + cbrt(-2.0)); else tmp = Float64(cbrt(Float64(Float64(g * -2.0) * Float64(0.5 / a))) + Float64(cbrt(g) / -2.0)); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[g, -120000000.0], N[Not[LessEqual[g, 70.0]], $MachinePrecision]], N[(N[Power[(-N[(g / a), $MachinePrecision]), 1/3], $MachinePrecision] + N[Power[-2.0, 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(g * -2.0), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[g, 1/3], $MachinePrecision] / -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq -120000000 \lor \neg \left(g \leq 70\right):\\
\;\;\;\;\sqrt[3]{-\frac{g}{a}} + \sqrt[3]{-2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\left(g \cdot -2\right) \cdot \frac{0.5}{a}} + \frac{\sqrt[3]{g}}{-2}\\
\end{array}
\end{array}
(FPCore (g h a)
:precision binary64
(let* ((t_0 (cbrt (* (/ -0.5 a) (+ g g)))))
(if (or (<= g -2.9e-22) (not (<= g 1.15e-5)))
(+ t_0 (cbrt (/ -2.0 g)))
(+ t_0 (cbrt g)))))
double code(double g, double h, double a) {
double t_0 = cbrt(((-0.5 / a) * (g + g)));
double tmp;
if ((g <= -2.9e-22) || !(g <= 1.15e-5)) {
tmp = t_0 + cbrt((-2.0 / g));
} else {
tmp = t_0 + cbrt(g);
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.cbrt(((-0.5 / a) * (g + g)));
double tmp;
if ((g <= -2.9e-22) || !(g <= 1.15e-5)) {
tmp = t_0 + Math.cbrt((-2.0 / g));
} else {
tmp = t_0 + Math.cbrt(g);
}
return tmp;
}
function code(g, h, a) t_0 = cbrt(Float64(Float64(-0.5 / a) * Float64(g + g))) tmp = 0.0 if ((g <= -2.9e-22) || !(g <= 1.15e-5)) tmp = Float64(t_0 + cbrt(Float64(-2.0 / g))); else tmp = Float64(t_0 + cbrt(g)); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[Or[LessEqual[g, -2.9e-22], N[Not[LessEqual[g, 1.15e-5]], $MachinePrecision]], N[(t$95$0 + N[Power[N[(-2.0 / g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\frac{-0.5}{a} \cdot \left(g + g\right)}\\
\mathbf{if}\;g \leq -2.9 \cdot 10^{-22} \lor \neg \left(g \leq 1.15 \cdot 10^{-5}\right):\\
\;\;\;\;t_0 + \sqrt[3]{\frac{-2}{g}}\\
\mathbf{else}:\\
\;\;\;\;t_0 + \sqrt[3]{g}\\
\end{array}
\end{array}
(FPCore (g h a) :precision binary64 (if (or (<= g -0.76) (not (<= g 8.5e-6))) (+ (cbrt (- (/ g a))) (cbrt -2.0)) (+ (cbrt (* (/ -0.5 a) (+ g g))) (cbrt g))))
double code(double g, double h, double a) {
double tmp;
if ((g <= -0.76) || !(g <= 8.5e-6)) {
tmp = cbrt(-(g / a)) + cbrt(-2.0);
} else {
tmp = cbrt(((-0.5 / a) * (g + g))) + cbrt(g);
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((g <= -0.76) || !(g <= 8.5e-6)) {
tmp = Math.cbrt(-(g / a)) + Math.cbrt(-2.0);
} else {
tmp = Math.cbrt(((-0.5 / a) * (g + g))) + Math.cbrt(g);
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((g <= -0.76) || !(g <= 8.5e-6)) tmp = Float64(cbrt(Float64(-Float64(g / a))) + cbrt(-2.0)); else tmp = Float64(cbrt(Float64(Float64(-0.5 / a) * Float64(g + g))) + cbrt(g)); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[g, -0.76], N[Not[LessEqual[g, 8.5e-6]], $MachinePrecision]], N[(N[Power[(-N[(g / a), $MachinePrecision]), 1/3], $MachinePrecision] + N[Power[-2.0, 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq -0.76 \lor \neg \left(g \leq 8.5 \cdot 10^{-6}\right):\\
\;\;\;\;\sqrt[3]{-\frac{g}{a}} + \sqrt[3]{-2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{-0.5}{a} \cdot \left(g + g\right)} + \sqrt[3]{g}\\
\end{array}
\end{array}
(FPCore (g h a) :precision binary64 (if (or (<= g -800000000.0) (not (<= g 2.15))) (+ (cbrt (- (/ g a))) (cbrt -2.0)) (- (cbrt (* (* g -2.0) (/ 0.5 a))) (cbrt g))))
double code(double g, double h, double a) {
double tmp;
if ((g <= -800000000.0) || !(g <= 2.15)) {
tmp = cbrt(-(g / a)) + cbrt(-2.0);
} else {
tmp = cbrt(((g * -2.0) * (0.5 / a))) - cbrt(g);
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((g <= -800000000.0) || !(g <= 2.15)) {
tmp = Math.cbrt(-(g / a)) + Math.cbrt(-2.0);
} else {
tmp = Math.cbrt(((g * -2.0) * (0.5 / a))) - Math.cbrt(g);
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((g <= -800000000.0) || !(g <= 2.15)) tmp = Float64(cbrt(Float64(-Float64(g / a))) + cbrt(-2.0)); else tmp = Float64(cbrt(Float64(Float64(g * -2.0) * Float64(0.5 / a))) - cbrt(g)); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[g, -800000000.0], N[Not[LessEqual[g, 2.15]], $MachinePrecision]], N[(N[Power[(-N[(g / a), $MachinePrecision]), 1/3], $MachinePrecision] + N[Power[-2.0, 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(g * -2.0), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq -800000000 \lor \neg \left(g \leq 2.15\right):\\
\;\;\;\;\sqrt[3]{-\frac{g}{a}} + \sqrt[3]{-2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\left(g \cdot -2\right) \cdot \frac{0.5}{a}} - \sqrt[3]{g}\\
\end{array}
\end{array}
(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(-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}
(FPCore (g h a) :precision binary64 (+ (cbrt (- (/ g a))) (cbrt -2.0)))
double code(double g, double h, double a) {
return cbrt(-(g / a)) + cbrt(-2.0);
}
public static double code(double g, double h, double a) {
return Math.cbrt(-(g / a)) + Math.cbrt(-2.0);
}
function code(g, h, a) return Float64(cbrt(Float64(-Float64(g / a))) + cbrt(-2.0)) end
code[g_, h_, a_] := N[(N[Power[(-N[(g / a), $MachinePrecision]), 1/3], $MachinePrecision] + N[Power[-2.0, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{-\frac{g}{a}} + \sqrt[3]{-2}
\end{array}
(FPCore (g h a) :precision binary64 (+ (cbrt -2.0) (/ (cbrt g) -2.0)))
double code(double g, double h, double a) {
return cbrt(-2.0) + (cbrt(g) / -2.0);
}
public static double code(double g, double h, double a) {
return Math.cbrt(-2.0) + (Math.cbrt(g) / -2.0);
}
function code(g, h, a) return Float64(cbrt(-2.0) + Float64(cbrt(g) / -2.0)) end
code[g_, h_, a_] := N[(N[Power[-2.0, 1/3], $MachinePrecision] + N[(N[Power[g, 1/3], $MachinePrecision] / -2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{-2} + \frac{\sqrt[3]{g}}{-2}
\end{array}
(FPCore (g h a) :precision binary64 (- (cbrt -2.0) (cbrt g)))
double code(double g, double h, double a) {
return cbrt(-2.0) - cbrt(g);
}
public static double code(double g, double h, double a) {
return Math.cbrt(-2.0) - Math.cbrt(g);
}
function code(g, h, a) return Float64(cbrt(-2.0) - cbrt(g)) end
code[g_, h_, a_] := N[(N[Power[-2.0, 1/3], $MachinePrecision] - N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{-2} - \sqrt[3]{g}
\end{array}
(FPCore (g h a) :precision binary64 (cbrt -2.0))
double code(double g, double h, double a) {
return cbrt(-2.0);
}
public static double code(double g, double h, double a) {
return Math.cbrt(-2.0);
}
function code(g, h, a) return cbrt(-2.0) end
code[g_, h_, a_] := N[Power[-2.0, 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{-2}
\end{array}
herbie shell --seed 2023346
(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))))))))