
(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 8 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 45.6%
Simplified45.6%
Taylor expanded in g around -inf 27.1%
*-commutative27.1%
Simplified27.1%
Taylor expanded in g around -inf 69.8%
neg-mul-169.8%
Simplified69.8%
associate-*l/69.9%
cbrt-div94.7%
*-commutative94.7%
associate-*r*94.7%
metadata-eval94.7%
neg-mul-194.7%
Applied egg-rr94.7%
Final simplification94.7%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (cbrt (* (- g g) (/ -0.5 a)))))
(if (<= a -1.8e-50)
(+ t_0 (cbrt (/ 1.0 (/ a (- g)))))
(if (<= a 4.4e-113)
(+ (/ (cbrt (- g)) (cbrt a)) (cbrt -2.0))
(+ t_0 (cbrt (/ (- g) a)))))))
double code(double g, double h, double a) {
double t_0 = cbrt(((g - g) * (-0.5 / a)));
double tmp;
if (a <= -1.8e-50) {
tmp = t_0 + cbrt((1.0 / (a / -g)));
} else if (a <= 4.4e-113) {
tmp = (cbrt(-g) / cbrt(a)) + cbrt(-2.0);
} else {
tmp = t_0 + cbrt((-g / 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.8e-50) {
tmp = t_0 + Math.cbrt((1.0 / (a / -g)));
} else if (a <= 4.4e-113) {
tmp = (Math.cbrt(-g) / Math.cbrt(a)) + Math.cbrt(-2.0);
} else {
tmp = t_0 + Math.cbrt((-g / 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.8e-50) tmp = Float64(t_0 + cbrt(Float64(1.0 / Float64(a / Float64(-g))))); elseif (a <= 4.4e-113) tmp = Float64(Float64(cbrt(Float64(-g)) / cbrt(a)) + cbrt(-2.0)); else tmp = Float64(t_0 + cbrt(Float64(Float64(-g) / 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.8e-50], N[(t$95$0 + N[Power[N[(1.0 / N[(a / (-g)), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.4e-113], 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[((-g) / a), $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.8 \cdot 10^{-50}:\\
\;\;\;\;t_0 + \sqrt[3]{\frac{1}{\frac{a}{-g}}}\\
\mathbf{elif}\;a \leq 4.4 \cdot 10^{-113}:\\
\;\;\;\;\frac{\sqrt[3]{-g}}{\sqrt[3]{a}} + \sqrt[3]{-2}\\
\mathbf{else}:\\
\;\;\;\;t_0 + \sqrt[3]{\frac{-g}{a}}\\
\end{array}
\end{array}
if a < -1.7999999999999999e-50Initial program 48.8%
Simplified48.8%
Taylor expanded in g around -inf 26.0%
*-commutative26.0%
Simplified26.0%
Taylor expanded in g around -inf 88.9%
neg-mul-188.9%
Simplified88.9%
associate-*l/17.7%
clear-num17.7%
*-commutative17.7%
associate-*r*17.7%
metadata-eval17.7%
neg-mul-117.7%
Applied egg-rr89.0%
if -1.7999999999999999e-50 < a < 4.40000000000000008e-113Initial program 39.2%
Simplified39.2%
Taylor expanded in g around -inf 27.8%
*-commutative27.8%
Simplified27.8%
Taylor expanded in g around inf 10.9%
add-sqr-sqrt6.3%
sqrt-unprod4.6%
*-commutative4.6%
*-commutative4.6%
swap-sqr3.6%
*-commutative3.6%
*-commutative3.6%
swap-sqr3.6%
metadata-eval3.6%
metadata-eval3.6%
swap-sqr3.6%
count-23.6%
count-23.6%
frac-times3.6%
metadata-eval3.6%
metadata-eval3.6%
frac-times3.6%
swap-sqr4.6%
sqrt-unprod6.3%
add-sqr-sqrt10.9%
expm1-log1p-u6.7%
Applied egg-rr0.0%
Simplified37.6%
add-sqr-sqrt22.9%
sqrt-unprod10.4%
swap-sqr7.8%
count-27.8%
count-27.8%
swap-sqr7.8%
metadata-eval7.8%
metadata-eval7.8%
swap-sqr7.8%
*-commutative7.8%
*-commutative7.8%
frac-times7.8%
metadata-eval7.8%
metadata-eval7.8%
frac-times7.8%
swap-sqr10.4%
*-commutative10.4%
*-commutative10.4%
sqrt-unprod22.9%
add-sqr-sqrt37.6%
Applied egg-rr88.8%
if 4.40000000000000008e-113 < a Initial program 50.5%
Simplified50.5%
Taylor expanded in g around -inf 27.3%
*-commutative27.3%
Simplified27.3%
Taylor expanded in g around -inf 86.7%
neg-mul-186.7%
Simplified86.7%
associate-*l/86.8%
*-commutative86.8%
associate-*r*86.8%
metadata-eval86.8%
neg-mul-186.8%
Applied egg-rr86.8%
Final simplification88.2%
(FPCore (g h a) :precision binary64 (if (or (<= a -8.4e-22) (not (<= a 3e-39))) (+ (cbrt (* (/ 0.5 a) (* g -2.0))) (/ -2.0 (cbrt a))) (+ (cbrt (- g)) (cbrt (* (/ -0.5 a) (+ g g))))))
double code(double g, double h, double a) {
double tmp;
if ((a <= -8.4e-22) || !(a <= 3e-39)) {
tmp = cbrt(((0.5 / a) * (g * -2.0))) + (-2.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 <= -8.4e-22) || !(a <= 3e-39)) {
tmp = Math.cbrt(((0.5 / a) * (g * -2.0))) + (-2.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 <= -8.4e-22) || !(a <= 3e-39)) tmp = Float64(cbrt(Float64(Float64(0.5 / a) * Float64(g * -2.0))) + Float64(-2.0 / cbrt(a))); else tmp = Float64(cbrt(Float64(-g)) + cbrt(Float64(Float64(-0.5 / a) * Float64(g + g)))); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[a, -8.4e-22], N[Not[LessEqual[a, 3e-39]], $MachinePrecision]], N[(N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(g * -2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(-2.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 -8.4 \cdot 10^{-22} \lor \neg \left(a \leq 3 \cdot 10^{-39}\right):\\
\;\;\;\;\sqrt[3]{\frac{0.5}{a} \cdot \left(g \cdot -2\right)} + \frac{-2}{\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 < -8.40000000000000031e-22 or 3.00000000000000028e-39 < a Initial program 47.3%
Simplified47.3%
Taylor expanded in g around -inf 26.0%
*-commutative26.0%
Simplified26.0%
Taylor expanded in g around inf 17.3%
Applied egg-rr0.0%
Simplified67.9%
if -8.40000000000000031e-22 < a < 3.00000000000000028e-39Initial program 43.6%
Simplified43.6%
Taylor expanded in g around -inf 28.5%
*-commutative28.5%
Simplified28.5%
Taylor expanded in g around inf 12.0%
Taylor expanded in a around 0 12.0%
Simplified49.9%
Final simplification59.6%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (cbrt (* (/ -0.5 a) (+ g g)))))
(if (<= g -2.0)
(+ (cbrt -2.0) (cbrt (/ (- g) a)))
(if (<= g 9.4e-32) (+ t_0 (cbrt g)) (+ (cbrt -2.0) t_0)))))
double code(double g, double h, double a) {
double t_0 = cbrt(((-0.5 / a) * (g + g)));
double tmp;
if (g <= -2.0) {
tmp = cbrt(-2.0) + cbrt((-g / a));
} else if (g <= 9.4e-32) {
tmp = t_0 + cbrt(g);
} else {
tmp = cbrt(-2.0) + t_0;
}
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.0) {
tmp = Math.cbrt(-2.0) + Math.cbrt((-g / a));
} else if (g <= 9.4e-32) {
tmp = t_0 + Math.cbrt(g);
} else {
tmp = Math.cbrt(-2.0) + t_0;
}
return tmp;
}
function code(g, h, a) t_0 = cbrt(Float64(Float64(-0.5 / a) * Float64(g + g))) tmp = 0.0 if (g <= -2.0) tmp = Float64(cbrt(-2.0) + cbrt(Float64(Float64(-g) / a))); elseif (g <= 9.4e-32) tmp = Float64(t_0 + cbrt(g)); else tmp = Float64(cbrt(-2.0) + t_0); 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[LessEqual[g, -2.0], N[(N[Power[-2.0, 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, 9.4e-32], N[(t$95$0 + N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[-2.0, 1/3], $MachinePrecision] + t$95$0), $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:\\
\;\;\;\;\sqrt[3]{-2} + \sqrt[3]{\frac{-g}{a}}\\
\mathbf{elif}\;g \leq 9.4 \cdot 10^{-32}:\\
\;\;\;\;t_0 + \sqrt[3]{g}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{-2} + t_0\\
\end{array}
\end{array}
if g < -2Initial program 36.2%
Simplified36.2%
Taylor expanded in g around -inf 36.3%
*-commutative36.3%
Simplified36.3%
Taylor expanded in g around inf 13.4%
add-sqr-sqrt7.6%
sqrt-unprod9.7%
*-commutative9.7%
*-commutative9.7%
swap-sqr14.6%
*-commutative14.6%
*-commutative14.6%
swap-sqr14.6%
metadata-eval14.6%
metadata-eval14.6%
swap-sqr14.6%
count-214.6%
count-214.6%
frac-times14.6%
metadata-eval14.6%
metadata-eval14.6%
frac-times14.6%
swap-sqr9.7%
sqrt-unprod7.6%
add-sqr-sqrt13.4%
expm1-log1p-u9.4%
Applied egg-rr0.0%
Simplified40.7%
Taylor expanded in g around 0 40.8%
neg-mul-140.8%
distribute-neg-frac40.8%
Simplified40.8%
if -2 < g < 9.40000000000000039e-32Initial program 65.9%
Simplified65.9%
Taylor expanded in g around -inf 45.6%
*-commutative45.6%
Simplified45.6%
Taylor expanded in g around inf 16.0%
associate-*l/16.0%
clear-num16.0%
*-commutative16.0%
associate-*r*16.0%
metadata-eval16.0%
neg-mul-116.0%
Applied egg-rr16.0%
Simplified52.7%
if 9.40000000000000039e-32 < g Initial program 40.9%
Simplified40.9%
Taylor expanded in g around -inf 9.9%
*-commutative9.9%
Simplified9.9%
Taylor expanded in g around inf 15.3%
add-sqr-sqrt8.0%
sqrt-unprod11.9%
*-commutative11.9%
*-commutative11.9%
swap-sqr14.2%
*-commutative14.2%
*-commutative14.2%
swap-sqr14.2%
metadata-eval14.2%
metadata-eval14.2%
swap-sqr14.2%
count-214.2%
count-214.2%
frac-times14.3%
metadata-eval14.3%
metadata-eval14.3%
frac-times14.2%
swap-sqr11.9%
sqrt-unprod8.0%
add-sqr-sqrt15.3%
expm1-log1p-u10.9%
Applied egg-rr0.0%
Simplified49.4%
Final simplification47.5%
(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}
Initial program 45.6%
Simplified45.6%
Taylor expanded in g around -inf 27.1%
*-commutative27.1%
Simplified27.1%
Taylor expanded in g around -inf 69.8%
neg-mul-169.8%
Simplified69.8%
associate-*l/69.9%
*-commutative69.9%
associate-*r*69.9%
metadata-eval69.9%
neg-mul-169.9%
Applied egg-rr69.9%
Final simplification69.9%
(FPCore (g h a) :precision binary64 (+ (cbrt -2.0) (cbrt (/ (- g) a))))
double code(double g, double h, double a) {
return cbrt(-2.0) + cbrt((-g / a));
}
public static double code(double g, double h, double a) {
return Math.cbrt(-2.0) + Math.cbrt((-g / a));
}
function code(g, h, a) return Float64(cbrt(-2.0) + cbrt(Float64(Float64(-g) / a))) end
code[g_, h_, a_] := N[(N[Power[-2.0, 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{-2} + \sqrt[3]{\frac{-g}{a}}
\end{array}
Initial program 45.6%
Simplified45.6%
Taylor expanded in g around -inf 27.1%
*-commutative27.1%
Simplified27.1%
Taylor expanded in g around inf 14.9%
add-sqr-sqrt8.3%
sqrt-unprod14.4%
*-commutative14.4%
*-commutative14.4%
swap-sqr16.9%
*-commutative16.9%
*-commutative16.9%
swap-sqr16.9%
metadata-eval16.9%
metadata-eval16.9%
swap-sqr16.9%
count-216.9%
count-216.9%
frac-times17.0%
metadata-eval17.0%
metadata-eval17.0%
frac-times16.9%
swap-sqr14.4%
sqrt-unprod8.3%
add-sqr-sqrt14.9%
expm1-log1p-u11.0%
Applied egg-rr0.0%
Simplified43.7%
Taylor expanded in g around 0 43.7%
neg-mul-143.7%
distribute-neg-frac43.7%
Simplified43.7%
Final simplification43.7%
(FPCore (g h a) :precision binary64 (+ (cbrt -2.0) (/ -2.0 (cbrt a))))
double code(double g, double h, double a) {
return cbrt(-2.0) + (-2.0 / cbrt(a));
}
public static double code(double g, double h, double a) {
return Math.cbrt(-2.0) + (-2.0 / Math.cbrt(a));
}
function code(g, h, a) return Float64(cbrt(-2.0) + Float64(-2.0 / cbrt(a))) end
code[g_, h_, a_] := N[(N[Power[-2.0, 1/3], $MachinePrecision] + N[(-2.0 / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{-2} + \frac{-2}{\sqrt[3]{a}}
\end{array}
Initial program 45.6%
Simplified45.6%
Taylor expanded in g around -inf 27.1%
*-commutative27.1%
Simplified27.1%
Taylor expanded in g around inf 14.9%
add-sqr-sqrt8.3%
sqrt-unprod14.4%
*-commutative14.4%
*-commutative14.4%
swap-sqr16.9%
*-commutative16.9%
*-commutative16.9%
swap-sqr16.9%
metadata-eval16.9%
metadata-eval16.9%
swap-sqr16.9%
count-216.9%
count-216.9%
frac-times17.0%
metadata-eval17.0%
metadata-eval17.0%
frac-times16.9%
swap-sqr14.4%
sqrt-unprod8.3%
add-sqr-sqrt14.9%
expm1-log1p-u11.0%
Applied egg-rr0.0%
Simplified43.7%
Applied egg-rr0.0%
Simplified4.6%
Final simplification4.6%
(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}
Initial program 45.6%
Simplified45.6%
Taylor expanded in g around -inf 27.1%
*-commutative27.1%
Simplified27.1%
Taylor expanded in g around inf 14.9%
add-sqr-sqrt8.3%
sqrt-unprod14.4%
*-commutative14.4%
*-commutative14.4%
swap-sqr16.9%
*-commutative16.9%
*-commutative16.9%
swap-sqr16.9%
metadata-eval16.9%
metadata-eval16.9%
swap-sqr16.9%
count-216.9%
count-216.9%
frac-times17.0%
metadata-eval17.0%
metadata-eval17.0%
frac-times16.9%
swap-sqr14.4%
sqrt-unprod8.3%
add-sqr-sqrt14.9%
expm1-log1p-u11.0%
Applied egg-rr0.0%
Simplified43.7%
Taylor expanded in g around 0 4.0%
Final simplification4.0%
herbie shell --seed 2024022
(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))))))))