
(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 (/ 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 37.4%
Simplified37.4%
Taylor expanded in g around -inf 24.0%
*-commutative24.0%
Simplified24.0%
Taylor expanded in g around -inf 69.0%
neg-mul-169.0%
Simplified69.0%
cbrt-prod94.9%
Applied egg-rr94.9%
Final simplification94.9%
(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}
Initial program 37.4%
Simplified37.4%
Taylor expanded in g around -inf 24.0%
*-commutative24.0%
Simplified24.0%
Taylor expanded in g around -inf 69.0%
neg-mul-169.0%
Simplified69.0%
associate-*l/41.5%
cbrt-div63.0%
*-commutative63.0%
associate-*r*63.0%
metadata-eval63.0%
neg-mul-163.0%
Applied egg-rr94.9%
Final simplification94.9%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (cbrt (* (- g g) (/ -0.5 a)))))
(if (<= a -3.2e-9)
(+ t_0 (cbrt (* (/ 0.5 a) (* g -2.0))))
(if (<= a 9.8e-39)
(+ (* (cbrt (/ 0.5 a)) (cbrt (* g -2.0))) -8.0)
(+ t_0 (cbrt (/ 1.0 (/ a (* 0.5 (* g -2.0))))))))))
double code(double g, double h, double a) {
double t_0 = cbrt(((g - g) * (-0.5 / a)));
double tmp;
if (a <= -3.2e-9) {
tmp = t_0 + cbrt(((0.5 / a) * (g * -2.0)));
} else if (a <= 9.8e-39) {
tmp = (cbrt((0.5 / a)) * cbrt((g * -2.0))) + -8.0;
} else {
tmp = t_0 + cbrt((1.0 / (a / (0.5 * (g * -2.0)))));
}
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 <= -3.2e-9) {
tmp = t_0 + Math.cbrt(((0.5 / a) * (g * -2.0)));
} else if (a <= 9.8e-39) {
tmp = (Math.cbrt((0.5 / a)) * Math.cbrt((g * -2.0))) + -8.0;
} else {
tmp = t_0 + Math.cbrt((1.0 / (a / (0.5 * (g * -2.0)))));
}
return tmp;
}
function code(g, h, a) t_0 = cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) tmp = 0.0 if (a <= -3.2e-9) tmp = Float64(t_0 + cbrt(Float64(Float64(0.5 / a) * Float64(g * -2.0)))); elseif (a <= 9.8e-39) tmp = Float64(Float64(cbrt(Float64(0.5 / a)) * cbrt(Float64(g * -2.0))) + -8.0); else tmp = Float64(t_0 + cbrt(Float64(1.0 / Float64(a / Float64(0.5 * Float64(g * -2.0)))))); 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, -3.2e-9], N[(t$95$0 + N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(g * -2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 9.8e-39], N[(N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(g * -2.0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + -8.0), $MachinePrecision], N[(t$95$0 + N[Power[N[(1.0 / N[(a / N[(0.5 * N[(g * -2.0), $MachinePrecision]), $MachinePrecision]), $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 -3.2 \cdot 10^{-9}:\\
\;\;\;\;t\_0 + \sqrt[3]{\frac{0.5}{a} \cdot \left(g \cdot -2\right)}\\
\mathbf{elif}\;a \leq 9.8 \cdot 10^{-39}:\\
\;\;\;\;\sqrt[3]{\frac{0.5}{a}} \cdot \sqrt[3]{g \cdot -2} + -8\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \sqrt[3]{\frac{1}{\frac{a}{0.5 \cdot \left(g \cdot -2\right)}}}\\
\end{array}
\end{array}
if a < -3.20000000000000012e-9Initial program 43.7%
Simplified43.7%
Taylor expanded in g around -inf 23.5%
*-commutative23.5%
Simplified23.5%
Taylor expanded in g around -inf 87.7%
neg-mul-187.7%
Simplified87.7%
if -3.20000000000000012e-9 < a < 9.79999999999999947e-39Initial program 29.3%
Simplified29.3%
Taylor expanded in g around -inf 22.4%
*-commutative22.4%
Simplified22.4%
Taylor expanded in g around inf 11.6%
expm1-log1p-u7.3%
expm1-undefine10.0%
*-commutative10.0%
flip-+0.0%
frac-times0.0%
unpow20.0%
unpow20.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified39.0%
cbrt-prod94.3%
Applied egg-rr86.0%
if 9.79999999999999947e-39 < a Initial program 44.7%
Simplified44.7%
Taylor expanded in g around -inf 27.4%
*-commutative27.4%
Simplified27.4%
Taylor expanded in g around -inf 86.3%
neg-mul-186.3%
Simplified86.3%
associate-*l/86.2%
clear-num86.3%
Applied egg-rr86.3%
Final simplification86.6%
(FPCore (g h a) :precision binary64 (if (or (<= a -7.8e-10) (not (<= a 1.4e-38))) (+ (cbrt (* (- g g) (/ -0.5 a))) (cbrt (* (/ 0.5 a) (* g -2.0)))) (+ (* (cbrt (/ 0.5 a)) (cbrt (* g -2.0))) -8.0)))
double code(double g, double h, double a) {
double tmp;
if ((a <= -7.8e-10) || !(a <= 1.4e-38)) {
tmp = cbrt(((g - g) * (-0.5 / a))) + cbrt(((0.5 / a) * (g * -2.0)));
} else {
tmp = (cbrt((0.5 / a)) * cbrt((g * -2.0))) + -8.0;
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((a <= -7.8e-10) || !(a <= 1.4e-38)) {
tmp = Math.cbrt(((g - g) * (-0.5 / a))) + Math.cbrt(((0.5 / a) * (g * -2.0)));
} else {
tmp = (Math.cbrt((0.5 / a)) * Math.cbrt((g * -2.0))) + -8.0;
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((a <= -7.8e-10) || !(a <= 1.4e-38)) tmp = Float64(cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) + cbrt(Float64(Float64(0.5 / a) * Float64(g * -2.0)))); else tmp = Float64(Float64(cbrt(Float64(0.5 / a)) * cbrt(Float64(g * -2.0))) + -8.0); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[a, -7.8e-10], N[Not[LessEqual[a, 1.4e-38]], $MachinePrecision]], 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], N[(N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(g * -2.0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + -8.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.8 \cdot 10^{-10} \lor \neg \left(a \leq 1.4 \cdot 10^{-38}\right):\\
\;\;\;\;\sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}} + \sqrt[3]{\frac{0.5}{a} \cdot \left(g \cdot -2\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{0.5}{a}} \cdot \sqrt[3]{g \cdot -2} + -8\\
\end{array}
\end{array}
if a < -7.7999999999999999e-10 or 1.4e-38 < a Initial program 44.1%
Simplified44.1%
Taylor expanded in g around -inf 25.3%
*-commutative25.3%
Simplified25.3%
Taylor expanded in g around -inf 87.1%
neg-mul-187.1%
Simplified87.1%
if -7.7999999999999999e-10 < a < 1.4e-38Initial program 29.3%
Simplified29.3%
Taylor expanded in g around -inf 22.4%
*-commutative22.4%
Simplified22.4%
Taylor expanded in g around inf 11.6%
expm1-log1p-u7.3%
expm1-undefine10.0%
*-commutative10.0%
flip-+0.0%
frac-times0.0%
unpow20.0%
unpow20.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified39.0%
cbrt-prod94.3%
Applied egg-rr86.0%
Final simplification86.6%
(FPCore (g h a) :precision binary64 (if (or (<= a -7.8e-10) (not (<= a 1e-36))) (- (cbrt (/ g a))) (+ (* (cbrt (/ 0.5 a)) (cbrt (* g -2.0))) -8.0)))
double code(double g, double h, double a) {
double tmp;
if ((a <= -7.8e-10) || !(a <= 1e-36)) {
tmp = -cbrt((g / a));
} else {
tmp = (cbrt((0.5 / a)) * cbrt((g * -2.0))) + -8.0;
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((a <= -7.8e-10) || !(a <= 1e-36)) {
tmp = -Math.cbrt((g / a));
} else {
tmp = (Math.cbrt((0.5 / a)) * Math.cbrt((g * -2.0))) + -8.0;
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((a <= -7.8e-10) || !(a <= 1e-36)) tmp = Float64(-cbrt(Float64(g / a))); else tmp = Float64(Float64(cbrt(Float64(0.5 / a)) * cbrt(Float64(g * -2.0))) + -8.0); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[a, -7.8e-10], N[Not[LessEqual[a, 1e-36]], $MachinePrecision]], (-N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), N[(N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(g * -2.0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + -8.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.8 \cdot 10^{-10} \lor \neg \left(a \leq 10^{-36}\right):\\
\;\;\;\;-\sqrt[3]{\frac{g}{a}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{0.5}{a}} \cdot \sqrt[3]{g \cdot -2} + -8\\
\end{array}
\end{array}
if a < -7.7999999999999999e-10 or 9.9999999999999994e-37 < a Initial program 44.1%
Simplified44.1%
Taylor expanded in g around -inf 25.3%
*-commutative25.3%
Simplified25.3%
Taylor expanded in g around inf 17.2%
expm1-log1p-u12.5%
expm1-undefine37.6%
*-commutative37.6%
flip-+0.0%
frac-times0.0%
unpow20.0%
unpow20.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified43.6%
Taylor expanded in g around -inf 87.0%
mul-1-neg87.0%
Simplified87.0%
if -7.7999999999999999e-10 < a < 9.9999999999999994e-37Initial program 29.3%
Simplified29.3%
Taylor expanded in g around -inf 22.4%
*-commutative22.4%
Simplified22.4%
Taylor expanded in g around inf 11.6%
expm1-log1p-u7.3%
expm1-undefine10.0%
*-commutative10.0%
flip-+0.0%
frac-times0.0%
unpow20.0%
unpow20.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified39.0%
cbrt-prod94.3%
Applied egg-rr86.0%
Final simplification86.6%
(FPCore (g h a) :precision binary64 (if (or (<= a -7.8e-10) (not (<= a 7.8e-61))) (- (cbrt (/ g a))) (+ (/ (cbrt (- g)) (cbrt a)) -8.0)))
double code(double g, double h, double a) {
double tmp;
if ((a <= -7.8e-10) || !(a <= 7.8e-61)) {
tmp = -cbrt((g / a));
} else {
tmp = (cbrt(-g) / cbrt(a)) + -8.0;
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((a <= -7.8e-10) || !(a <= 7.8e-61)) {
tmp = -Math.cbrt((g / a));
} else {
tmp = (Math.cbrt(-g) / Math.cbrt(a)) + -8.0;
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((a <= -7.8e-10) || !(a <= 7.8e-61)) tmp = Float64(-cbrt(Float64(g / a))); else tmp = Float64(Float64(cbrt(Float64(-g)) / cbrt(a)) + -8.0); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[a, -7.8e-10], N[Not[LessEqual[a, 7.8e-61]], $MachinePrecision]], (-N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), N[(N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + -8.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.8 \cdot 10^{-10} \lor \neg \left(a \leq 7.8 \cdot 10^{-61}\right):\\
\;\;\;\;-\sqrt[3]{\frac{g}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{-g}}{\sqrt[3]{a}} + -8\\
\end{array}
\end{array}
if a < -7.7999999999999999e-10 or 7.80000000000000065e-61 < a Initial program 43.4%
Simplified43.4%
Taylor expanded in g around -inf 25.4%
*-commutative25.4%
Simplified25.4%
Taylor expanded in g around inf 17.2%
expm1-log1p-u12.5%
expm1-undefine36.3%
*-commutative36.3%
flip-+0.0%
frac-times0.0%
unpow20.0%
unpow20.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified44.9%
Taylor expanded in g around -inf 86.9%
mul-1-neg86.9%
Simplified86.9%
if -7.7999999999999999e-10 < a < 7.80000000000000065e-61Initial program 29.4%
Simplified29.4%
Taylor expanded in g around -inf 22.0%
*-commutative22.0%
Simplified22.0%
Taylor expanded in g around inf 11.3%
expm1-log1p-u7.0%
expm1-undefine9.9%
*-commutative9.9%
flip-+0.0%
frac-times0.0%
unpow20.0%
unpow20.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified36.9%
associate-*l/36.9%
cbrt-div85.9%
*-commutative85.9%
associate-*r*85.9%
metadata-eval85.9%
neg-mul-185.9%
Applied egg-rr85.9%
Final simplification86.5%
(FPCore (g h a) :precision binary64 (- (cbrt (/ g a))))
double code(double g, double h, double a) {
return -cbrt((g / a));
}
public static double code(double g, double h, double a) {
return -Math.cbrt((g / a));
}
function code(g, h, a) return Float64(-cbrt(Float64(g / a))) end
code[g_, h_, a_] := (-N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision])
\begin{array}{l}
\\
-\sqrt[3]{\frac{g}{a}}
\end{array}
Initial program 37.4%
Simplified37.4%
Taylor expanded in g around -inf 24.0%
*-commutative24.0%
Simplified24.0%
Taylor expanded in g around inf 14.7%
expm1-log1p-u10.1%
expm1-undefine25.1%
*-commutative25.1%
flip-+0.0%
frac-times0.0%
unpow20.0%
unpow20.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified41.5%
Taylor expanded in g around -inf 69.0%
mul-1-neg69.0%
Simplified69.0%
Final simplification69.0%
(FPCore (g h a) :precision binary64 (+ -8.0 (cbrt g)))
double code(double g, double h, double a) {
return -8.0 + cbrt(g);
}
public static double code(double g, double h, double a) {
return -8.0 + Math.cbrt(g);
}
function code(g, h, a) return Float64(-8.0 + cbrt(g)) end
code[g_, h_, a_] := N[(-8.0 + N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-8 + \sqrt[3]{g}
\end{array}
Initial program 37.4%
Simplified37.4%
Taylor expanded in g around -inf 24.0%
*-commutative24.0%
Simplified24.0%
Taylor expanded in g around inf 14.7%
expm1-log1p-u10.1%
expm1-undefine25.1%
*-commutative25.1%
flip-+0.0%
frac-times0.0%
unpow20.0%
unpow20.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified41.5%
Taylor expanded in a around 0 41.5%
Simplified4.8%
Final simplification4.8%
herbie shell --seed 2024072
(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))))))))