
(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 11 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 a)) (cbrt (* g -2.0))) (cbrt (* (- g g) (/ -0.5 a)))))
double code(double g, double h, double a) {
return (cbrt((0.5 / 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 / a)) * Math.cbrt((g * -2.0))) + Math.cbrt(((g - g) * (-0.5 / a)));
}
function code(g, h, a) return Float64(Float64(cbrt(Float64(0.5 / a)) * cbrt(Float64(g * -2.0))) + cbrt(Float64(Float64(g - g) * Float64(-0.5 / a)))) end
code[g_, h_, a_] := N[(N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $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}
\\
\sqrt[3]{\frac{0.5}{a}} \cdot \sqrt[3]{g \cdot -2} + \sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}}
\end{array}
Initial program 44.8%
Simplified44.8%
Taylor expanded in g around -inf 25.7%
*-commutative25.7%
Simplified25.7%
Taylor expanded in g around -inf 78.6%
neg-mul-178.6%
Simplified78.6%
cbrt-prod96.1%
Applied egg-rr96.1%
Final simplification96.1%
(FPCore (g h a) :precision binary64 (+ (/ (cbrt (- g)) (cbrt a)) (cbrt 0.0)))
double code(double g, double h, double a) {
return (cbrt(-g) / cbrt(a)) + cbrt(0.0);
}
public static double code(double g, double h, double a) {
return (Math.cbrt(-g) / Math.cbrt(a)) + Math.cbrt(0.0);
}
function code(g, h, a) return Float64(Float64(cbrt(Float64(-g)) / cbrt(a)) + cbrt(0.0)) end
code[g_, h_, a_] := N[(N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[0.0, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt[3]{-g}}{\sqrt[3]{a}} + \sqrt[3]{0}
\end{array}
Initial program 44.8%
Simplified44.8%
Taylor expanded in g around -inf 25.7%
*-commutative25.7%
Simplified25.7%
Taylor expanded in g around inf 16.0%
associate-*l/16.0%
cbrt-div17.9%
*-commutative17.9%
associate-*r*17.9%
metadata-eval17.9%
neg-mul-117.9%
Applied egg-rr17.9%
count-217.9%
*-commutative17.9%
frac-2neg17.9%
metadata-eval17.9%
count-217.9%
flip-+0.0%
frac-times0.0%
unpow20.0%
unpow20.0%
*-un-lft-identity0.0%
fma-neg0.0%
add-sqr-sqrt11.1%
sqrt-unprod27.8%
sqr-neg27.8%
sqrt-prod25.2%
add-sqr-sqrt48.6%
fma-def48.6%
*-un-lft-identity48.6%
count-248.6%
*-commutative48.6%
Applied egg-rr48.6%
+-inverses93.3%
metadata-eval93.3%
*-commutative93.3%
div096.1%
Simplified96.1%
Final simplification96.1%
(FPCore (g h a) :precision binary64 (if (or (<= g -1.9e+16) (not (<= g 1250000.0))) (+ (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 ((g <= -1.9e+16) || !(g <= 1250000.0)) {
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 ((g <= -1.9e+16) || !(g <= 1250000.0)) {
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 ((g <= -1.9e+16) || !(g <= 1250000.0)) 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[g, -1.9e+16], N[Not[LessEqual[g, 1250000.0]], $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}\;g \leq -1.9 \cdot 10^{+16} \lor \neg \left(g \leq 1250000\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 g < -1.9e16 or 1.25e6 < g Initial program 34.0%
Simplified34.0%
Taylor expanded in g around -inf 19.2%
*-commutative19.2%
Simplified19.2%
Taylor expanded in g around inf 15.5%
expm1-log1p-u20.7%
expm1-udef20.7%
Applied egg-rr0.0%
Simplified72.2%
if -1.9e16 < g < 1.25e6Initial program 76.8%
Simplified76.8%
Taylor expanded in g around -inf 44.7%
*-commutative44.7%
Simplified44.7%
Taylor expanded in g around inf 17.6%
Taylor expanded in a around 0 17.6%
Simplified42.6%
Final simplification64.7%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (cbrt (* (/ -0.5 a) (+ g g)))))
(if (<= g -6e+35)
(+ (cbrt -2.0) (cbrt (/ g (- a))))
(if (<= g 2.0) (+ (cbrt (- g)) t_0) (+ t_0 (cbrt -2.0))))))
double code(double g, double h, double a) {
double t_0 = cbrt(((-0.5 / a) * (g + g)));
double tmp;
if (g <= -6e+35) {
tmp = cbrt(-2.0) + cbrt((g / -a));
} else if (g <= 2.0) {
tmp = cbrt(-g) + t_0;
} else {
tmp = t_0 + cbrt(-2.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 <= -6e+35) {
tmp = Math.cbrt(-2.0) + Math.cbrt((g / -a));
} else if (g <= 2.0) {
tmp = Math.cbrt(-g) + t_0;
} else {
tmp = t_0 + Math.cbrt(-2.0);
}
return tmp;
}
function code(g, h, a) t_0 = cbrt(Float64(Float64(-0.5 / a) * Float64(g + g))) tmp = 0.0 if (g <= -6e+35) tmp = Float64(cbrt(-2.0) + cbrt(Float64(g / Float64(-a)))); elseif (g <= 2.0) tmp = Float64(cbrt(Float64(-g)) + t_0); else tmp = Float64(t_0 + cbrt(-2.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, -6e+35], N[(N[Power[-2.0, 1/3], $MachinePrecision] + N[Power[N[(g / (-a)), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, 2.0], N[(N[Power[(-g), 1/3], $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$0 + N[Power[-2.0, 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 -6 \cdot 10^{+35}:\\
\;\;\;\;\sqrt[3]{-2} + \sqrt[3]{\frac{g}{-a}}\\
\mathbf{elif}\;g \leq 2:\\
\;\;\;\;\sqrt[3]{-g} + t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 + \sqrt[3]{-2}\\
\end{array}
\end{array}
if g < -5.99999999999999981e35Initial program 23.8%
Simplified23.8%
Taylor expanded in g around -inf 24.1%
*-commutative24.1%
Simplified24.1%
Taylor expanded in g around inf 15.9%
add-sqr-sqrt7.2%
sqrt-unprod6.3%
*-commutative6.3%
*-commutative6.3%
swap-sqr8.2%
*-commutative8.2%
*-commutative8.2%
swap-sqr8.2%
metadata-eval8.2%
metadata-eval8.2%
swap-sqr8.2%
count-28.2%
count-28.2%
frac-times8.2%
metadata-eval8.2%
metadata-eval8.2%
frac-times8.2%
swap-sqr6.3%
sqrt-unprod7.2%
add-sqr-sqrt15.9%
expm1-log1p-u8.8%
Applied egg-rr0.0%
Simplified57.8%
Taylor expanded in g around 0 57.8%
associate-*r/57.8%
metadata-eval57.8%
associate-*r*57.8%
*-commutative57.8%
associate-*l/57.8%
*-commutative57.8%
associate-*l*57.8%
*-lft-identity57.8%
associate-*l*57.8%
associate-*l*57.8%
*-commutative57.8%
metadata-eval57.8%
*-commutative57.8%
associate-*r/57.8%
associate-*l*57.8%
metadata-eval57.8%
metadata-eval57.8%
associate-*l*57.8%
times-frac57.8%
neg-mul-157.8%
distribute-rgt-neg-in57.8%
metadata-eval57.8%
associate-*l*57.8%
metadata-eval57.8%
*-rgt-identity57.8%
neg-mul-157.8%
Simplified57.8%
if -5.99999999999999981e35 < g < 2Initial program 78.1%
Simplified78.1%
Taylor expanded in g around -inf 50.2%
*-commutative50.2%
Simplified50.2%
Taylor expanded in g around inf 17.7%
Taylor expanded in a around 0 17.7%
Simplified41.8%
if 2 < g Initial program 40.5%
Simplified40.5%
Taylor expanded in g around -inf 9.9%
*-commutative9.9%
Simplified9.9%
Taylor expanded in g around inf 15.0%
add-sqr-sqrt7.4%
sqrt-unprod10.7%
*-commutative10.7%
*-commutative10.7%
swap-sqr13.2%
*-commutative13.2%
*-commutative13.2%
swap-sqr13.2%
metadata-eval13.2%
metadata-eval13.2%
swap-sqr13.2%
count-213.2%
count-213.2%
frac-times13.1%
metadata-eval13.1%
metadata-eval13.1%
frac-times13.2%
swap-sqr10.7%
sqrt-unprod7.4%
add-sqr-sqrt15.0%
expm1-log1p-u9.3%
Applied egg-rr0.0%
Simplified47.1%
Final simplification49.4%
(FPCore (g h a) :precision binary64 (+ (cbrt (* (- g g) (/ -0.5 a))) (cbrt (* (/ 0.5 a) (* g -2.0)))))
double code(double g, double h, double a) {
return cbrt(((g - g) * (-0.5 / a))) + cbrt(((0.5 / a) * (g * -2.0)));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((g - g) * (-0.5 / a))) + Math.cbrt(((0.5 / a) * (g * -2.0)));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) + cbrt(Float64(Float64(0.5 / a) * Float64(g * -2.0)))) 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 * -2.0), $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 \cdot -2\right)}
\end{array}
Initial program 44.8%
Simplified44.8%
Taylor expanded in g around -inf 25.7%
*-commutative25.7%
Simplified25.7%
Taylor expanded in g around -inf 78.6%
neg-mul-178.6%
Simplified78.6%
Final simplification78.6%
(FPCore (g h a) :precision binary64 (+ (cbrt (* (- g g) (/ -0.5 a))) (cbrt (/ 1.0 (/ a (- g))))))
double code(double g, double h, double a) {
return cbrt(((g - g) * (-0.5 / a))) + cbrt((1.0 / (a / -g)));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((g - g) * (-0.5 / a))) + Math.cbrt((1.0 / (a / -g)));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) + cbrt(Float64(1.0 / Float64(a / Float64(-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[(1.0 / N[(a / (-g)), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}} + \sqrt[3]{\frac{1}{\frac{a}{-g}}}
\end{array}
Initial program 44.8%
Simplified44.8%
Taylor expanded in g around -inf 25.7%
*-commutative25.7%
Simplified25.7%
Taylor expanded in g around -inf 78.6%
neg-mul-178.6%
Simplified78.6%
associate-*l/78.6%
clear-num78.6%
*-commutative78.6%
associate-*r*78.6%
metadata-eval78.6%
neg-mul-178.6%
Applied egg-rr78.6%
Final simplification78.6%
(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 44.8%
Simplified44.8%
Taylor expanded in g around -inf 25.7%
*-commutative25.7%
Simplified25.7%
Taylor expanded in g around -inf 78.6%
neg-mul-178.6%
Simplified78.6%
associate-*l/78.6%
*-commutative78.6%
associate-*r*78.6%
metadata-eval78.6%
neg-mul-178.6%
Applied egg-rr78.6%
Final simplification78.6%
(FPCore (g h a) :precision binary64 (+ (cbrt (* (/ -0.5 a) (+ g g))) (cbrt -2.0)))
double code(double g, double h, double a) {
return cbrt(((-0.5 / a) * (g + g))) + cbrt(-2.0);
}
public static double code(double g, double h, double a) {
return Math.cbrt(((-0.5 / a) * (g + g))) + Math.cbrt(-2.0);
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(-0.5 / a) * Float64(g + g))) + cbrt(-2.0)) end
code[g_, h_, a_] := N[(N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[-2.0, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{-0.5}{a} \cdot \left(g + g\right)} + \sqrt[3]{-2}
\end{array}
Initial program 44.8%
Simplified44.8%
Taylor expanded in g around -inf 25.7%
*-commutative25.7%
Simplified25.7%
Taylor expanded in g around inf 16.0%
add-sqr-sqrt8.1%
sqrt-unprod16.9%
*-commutative16.9%
*-commutative16.9%
swap-sqr19.0%
*-commutative19.0%
*-commutative19.0%
swap-sqr19.0%
metadata-eval19.0%
metadata-eval19.0%
swap-sqr19.0%
count-219.0%
count-219.0%
frac-times18.9%
metadata-eval18.9%
metadata-eval18.9%
frac-times19.0%
swap-sqr16.9%
sqrt-unprod8.1%
add-sqr-sqrt16.0%
expm1-log1p-u10.7%
Applied egg-rr0.0%
Simplified45.0%
Final simplification45.0%
(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(g / Float64(-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 44.8%
Simplified44.8%
Taylor expanded in g around -inf 25.7%
*-commutative25.7%
Simplified25.7%
Taylor expanded in g around inf 16.0%
add-sqr-sqrt8.1%
sqrt-unprod16.9%
*-commutative16.9%
*-commutative16.9%
swap-sqr19.0%
*-commutative19.0%
*-commutative19.0%
swap-sqr19.0%
metadata-eval19.0%
metadata-eval19.0%
swap-sqr19.0%
count-219.0%
count-219.0%
frac-times18.9%
metadata-eval18.9%
metadata-eval18.9%
frac-times19.0%
swap-sqr16.9%
sqrt-unprod8.1%
add-sqr-sqrt16.0%
expm1-log1p-u10.7%
Applied egg-rr0.0%
Simplified45.0%
Taylor expanded in g around 0 45.0%
associate-*r/45.0%
metadata-eval45.0%
associate-*r*45.0%
*-commutative45.0%
associate-*l/45.0%
*-commutative45.0%
associate-*l*45.0%
*-lft-identity45.0%
associate-*l*45.0%
associate-*l*45.0%
*-commutative45.0%
metadata-eval45.0%
*-commutative45.0%
associate-*r/45.0%
associate-*l*45.0%
metadata-eval45.0%
metadata-eval45.0%
associate-*l*45.0%
times-frac45.0%
neg-mul-145.0%
distribute-rgt-neg-in45.0%
metadata-eval45.0%
associate-*l*45.0%
metadata-eval45.0%
*-rgt-identity45.0%
neg-mul-145.0%
Simplified45.0%
Final simplification45.0%
(FPCore (g h a) :precision binary64 (+ (/ -2.0 (cbrt a)) (cbrt -2.0)))
double code(double g, double h, double a) {
return (-2.0 / cbrt(a)) + cbrt(-2.0);
}
public static double code(double g, double h, double a) {
return (-2.0 / Math.cbrt(a)) + Math.cbrt(-2.0);
}
function code(g, h, a) return Float64(Float64(-2.0 / cbrt(a)) + cbrt(-2.0)) end
code[g_, h_, a_] := N[(N[(-2.0 / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[-2.0, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-2}{\sqrt[3]{a}} + \sqrt[3]{-2}
\end{array}
Initial program 44.8%
Simplified44.8%
Taylor expanded in g around -inf 25.7%
*-commutative25.7%
Simplified25.7%
Taylor expanded in g around inf 16.0%
add-sqr-sqrt8.1%
sqrt-unprod16.9%
*-commutative16.9%
*-commutative16.9%
swap-sqr19.0%
*-commutative19.0%
*-commutative19.0%
swap-sqr19.0%
metadata-eval19.0%
metadata-eval19.0%
swap-sqr19.0%
count-219.0%
count-219.0%
frac-times18.9%
metadata-eval18.9%
metadata-eval18.9%
frac-times19.0%
swap-sqr16.9%
sqrt-unprod8.1%
add-sqr-sqrt16.0%
expm1-log1p-u10.7%
Applied egg-rr0.0%
Simplified45.0%
expm1-log1p-u18.4%
expm1-udef18.4%
Applied egg-rr0.0%
Simplified4.9%
Final simplification4.9%
(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 44.8%
Simplified44.8%
Taylor expanded in g around -inf 25.7%
*-commutative25.7%
Simplified25.7%
Taylor expanded in g around inf 16.0%
add-sqr-sqrt8.1%
sqrt-unprod16.9%
*-commutative16.9%
*-commutative16.9%
swap-sqr19.0%
*-commutative19.0%
*-commutative19.0%
swap-sqr19.0%
metadata-eval19.0%
metadata-eval19.0%
swap-sqr19.0%
count-219.0%
count-219.0%
frac-times18.9%
metadata-eval18.9%
metadata-eval18.9%
frac-times19.0%
swap-sqr16.9%
sqrt-unprod8.1%
add-sqr-sqrt16.0%
expm1-log1p-u10.7%
Applied egg-rr0.0%
Simplified45.0%
Taylor expanded in g around 0 4.4%
Final simplification4.4%
herbie shell --seed 2024026
(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))))))))