
(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 10 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.9%
Simplified45.9%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around -inf 75.3%
neg-mul-175.3%
Simplified75.3%
associate-*l/75.3%
cbrt-div95.9%
Applied egg-rr95.9%
*-commutative95.9%
associate-*r*96.3%
metadata-eval96.3%
neg-mul-196.3%
Simplified96.3%
Final simplification96.3%
(FPCore (g h a) :precision binary64 (if (or (<= a -4.3e-129) (not (<= a 1.1e-23))) (+ (cbrt (* (- g g) (/ -0.5 a))) (cbrt (/ -1.0 (/ a g)))) (+ (/ (cbrt (- g)) (cbrt a)) (cbrt -1.0))))
double code(double g, double h, double a) {
double tmp;
if ((a <= -4.3e-129) || !(a <= 1.1e-23)) {
tmp = cbrt(((g - g) * (-0.5 / a))) + cbrt((-1.0 / (a / g)));
} 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 <= -4.3e-129) || !(a <= 1.1e-23)) {
tmp = Math.cbrt(((g - g) * (-0.5 / a))) + Math.cbrt((-1.0 / (a / g)));
} else {
tmp = (Math.cbrt(-g) / Math.cbrt(a)) + Math.cbrt(-1.0);
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((a <= -4.3e-129) || !(a <= 1.1e-23)) tmp = Float64(cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) + cbrt(Float64(-1.0 / Float64(a / g)))); else tmp = Float64(Float64(cbrt(Float64(-g)) / cbrt(a)) + cbrt(-1.0)); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[a, -4.3e-129], N[Not[LessEqual[a, 1.1e-23]], $MachinePrecision]], 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], 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 -4.3 \cdot 10^{-129} \lor \neg \left(a \leq 1.1 \cdot 10^{-23}\right):\\
\;\;\;\;\sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}} + \sqrt[3]{\frac{-1}{\frac{a}{g}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{-g}}{\sqrt[3]{a}} + \sqrt[3]{-1}\\
\end{array}
\end{array}
if a < -4.29999999999999981e-129 or 1.1e-23 < a Initial program 51.0%
Simplified51.0%
Taylor expanded in g around -inf 30.1%
*-commutative30.1%
Simplified30.1%
Taylor expanded in g around -inf 91.9%
neg-mul-191.9%
Simplified91.9%
associate-*l/91.9%
clear-num91.9%
*-commutative91.9%
associate-*r*91.9%
metadata-eval91.9%
neg-mul-191.9%
Applied egg-rr91.9%
if -4.29999999999999981e-129 < a < 1.1e-23Initial program 38.7%
Simplified38.7%
Taylor expanded in g around -inf 25.5%
*-commutative25.5%
Simplified25.5%
Taylor expanded in g around inf 11.8%
add-sqr-sqrt7.2%
sqrt-unprod5.0%
*-commutative5.0%
*-commutative5.0%
swap-sqr5.4%
*-commutative5.4%
*-commutative5.4%
swap-sqr5.4%
metadata-eval5.4%
metadata-eval5.4%
swap-sqr5.4%
count-25.4%
count-25.4%
frac-times5.5%
metadata-eval5.5%
metadata-eval5.5%
frac-times5.4%
swap-sqr5.0%
sqrt-unprod7.2%
add-sqr-sqrt11.8%
associate-*r/11.8%
Applied egg-rr0.0%
Simplified45.9%
add-sqr-sqrt28.7%
sqrt-unprod10.0%
swap-sqr5.2%
count-25.2%
count-25.2%
swap-sqr5.2%
metadata-eval5.2%
metadata-eval5.2%
swap-sqr5.2%
*-commutative5.2%
*-commutative5.2%
frac-times5.2%
metadata-eval5.2%
metadata-eval5.2%
frac-times5.2%
swap-sqr10.0%
*-commutative10.0%
*-commutative10.0%
sqrt-unprod28.7%
add-sqr-sqrt45.9%
Applied egg-rr91.0%
Final simplification91.5%
(FPCore (g h a) :precision binary64 (+ (* (cbrt (/ 0.5 a)) (cbrt (* g -2.0))) (cbrt 0.0)))
double code(double g, double h, double a) {
return (cbrt((0.5 / a)) * cbrt((g * -2.0))) + cbrt(0.0);
}
public static double code(double g, double h, double a) {
return (Math.cbrt((0.5 / a)) * Math.cbrt((g * -2.0))) + Math.cbrt(0.0);
}
function code(g, h, a) return Float64(Float64(cbrt(Float64(0.5 / a)) * cbrt(Float64(g * -2.0))) + cbrt(0.0)) 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[0.0, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{0.5}{a}} \cdot \sqrt[3]{g \cdot -2} + \sqrt[3]{0}
\end{array}
Initial program 45.9%
Simplified45.9%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around inf 15.5%
cbrt-prod17.9%
Applied egg-rr17.9%
Applied egg-rr96.1%
Final simplification96.1%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (cbrt (* (/ 0.5 a) (* g -2.0)))))
(if (or (<= g -1e+30) (not (<= g 19000000000.0)))
(+ t_0 (/ -1.0 (cbrt a)))
(+ t_0 (cbrt g)))))
double code(double g, double h, double a) {
double t_0 = cbrt(((0.5 / a) * (g * -2.0)));
double tmp;
if ((g <= -1e+30) || !(g <= 19000000000.0)) {
tmp = t_0 + (-1.0 / cbrt(a));
} 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 * -2.0)));
double tmp;
if ((g <= -1e+30) || !(g <= 19000000000.0)) {
tmp = t_0 + (-1.0 / Math.cbrt(a));
} else {
tmp = t_0 + Math.cbrt(g);
}
return tmp;
}
function code(g, h, a) t_0 = cbrt(Float64(Float64(0.5 / a) * Float64(g * -2.0))) tmp = 0.0 if ((g <= -1e+30) || !(g <= 19000000000.0)) tmp = Float64(t_0 + Float64(-1.0 / cbrt(a))); 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 * -2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[Or[LessEqual[g, -1e+30], N[Not[LessEqual[g, 19000000000.0]], $MachinePrecision]], N[(t$95$0 + N[(-1.0 / N[Power[a, 1/3], $MachinePrecision]), $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 \cdot -2\right)}\\
\mathbf{if}\;g \leq -1 \cdot 10^{+30} \lor \neg \left(g \leq 19000000000\right):\\
\;\;\;\;t\_0 + \frac{-1}{\sqrt[3]{a}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \sqrt[3]{g}\\
\end{array}
\end{array}
if g < -1e30 or 1.9e10 < g Initial program 34.7%
Simplified34.7%
Taylor expanded in g around -inf 19.2%
*-commutative19.2%
Simplified19.2%
Taylor expanded in g around inf 14.7%
associate-*r/44.7%
cbrt-div70.2%
Applied egg-rr0.0%
Simplified69.6%
if -1e30 < g < 1.9e10Initial program 75.1%
Simplified75.1%
Taylor expanded in g around -inf 51.7%
*-commutative51.7%
Simplified51.7%
Taylor expanded in g around inf 17.3%
Taylor expanded in g around 0 17.3%
Simplified48.7%
Final simplification63.8%
(FPCore (g h a) :precision binary64 (if (or (<= g -2.2) (not (<= g 1.1e-11))) (+ (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 <= -2.2) || !(g <= 1.1e-11)) {
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 <= -2.2) || !(g <= 1.1e-11)) {
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 <= -2.2) || !(g <= 1.1e-11)) tmp = Float64(cbrt(-1.0) + cbrt(Float64(Float64(-g) / 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, -2.2], N[Not[LessEqual[g, 1.1e-11]], $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 -2.2 \lor \neg \left(g \leq 1.1 \cdot 10^{-11}\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 < -2.2000000000000002 or 1.1000000000000001e-11 < g Initial program 37.4%
Simplified37.4%
Taylor expanded in g around -inf 20.8%
*-commutative20.8%
Simplified20.8%
Taylor expanded in g around inf 14.9%
add-sqr-sqrt7.2%
sqrt-unprod9.4%
*-commutative9.4%
*-commutative9.4%
swap-sqr12.2%
*-commutative12.2%
*-commutative12.2%
swap-sqr12.2%
metadata-eval12.2%
metadata-eval12.2%
swap-sqr12.2%
count-212.2%
count-212.2%
frac-times12.2%
metadata-eval12.2%
metadata-eval12.2%
frac-times12.2%
swap-sqr9.4%
sqrt-unprod7.2%
add-sqr-sqrt14.9%
associate-*r/14.9%
Applied egg-rr0.0%
Simplified46.5%
Taylor expanded in g around 0 46.5%
mul-1-neg46.5%
distribute-neg-frac246.5%
Simplified46.5%
if -2.2000000000000002 < g < 1.1000000000000001e-11Initial program 72.1%
Simplified72.1%
Taylor expanded in g around -inf 50.8%
*-commutative50.8%
Simplified50.8%
Taylor expanded in g around inf 17.2%
Taylor expanded in g around 0 17.2%
Simplified43.8%
Final simplification45.8%
(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 45.9%
Simplified45.9%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around -inf 75.3%
neg-mul-175.3%
Simplified75.3%
Taylor expanded in g around -inf 75.3%
mul-1-neg75.3%
Simplified75.3%
Final simplification75.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(Float64(-g) / 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 45.9%
Simplified45.9%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around inf 15.5%
add-sqr-sqrt8.0%
sqrt-unprod15.4%
*-commutative15.4%
*-commutative15.4%
swap-sqr18.0%
*-commutative18.0%
*-commutative18.0%
swap-sqr18.0%
metadata-eval18.0%
metadata-eval18.0%
swap-sqr18.0%
count-218.0%
count-218.0%
frac-times18.0%
metadata-eval18.0%
metadata-eval18.0%
frac-times18.0%
swap-sqr15.4%
sqrt-unprod8.0%
add-sqr-sqrt15.5%
associate-*r/15.5%
Applied egg-rr0.0%
Simplified42.1%
Taylor expanded in g around 0 42.1%
mul-1-neg42.1%
distribute-neg-frac242.1%
Simplified42.1%
Final simplification42.1%
(FPCore (g h a) :precision binary64 (+ (cbrt -1.0) (/ -1.0 (cbrt a))))
double code(double g, double h, double a) {
return cbrt(-1.0) + (-1.0 / cbrt(a));
}
public static double code(double g, double h, double a) {
return Math.cbrt(-1.0) + (-1.0 / Math.cbrt(a));
}
function code(g, h, a) return Float64(cbrt(-1.0) + Float64(-1.0 / cbrt(a))) end
code[g_, h_, a_] := N[(N[Power[-1.0, 1/3], $MachinePrecision] + N[(-1.0 / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{-1} + \frac{-1}{\sqrt[3]{a}}
\end{array}
Initial program 45.9%
Simplified45.9%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around inf 15.5%
add-sqr-sqrt8.0%
sqrt-unprod15.4%
*-commutative15.4%
*-commutative15.4%
swap-sqr18.0%
*-commutative18.0%
*-commutative18.0%
swap-sqr18.0%
metadata-eval18.0%
metadata-eval18.0%
swap-sqr18.0%
count-218.0%
count-218.0%
frac-times18.0%
metadata-eval18.0%
metadata-eval18.0%
frac-times18.0%
swap-sqr15.4%
sqrt-unprod8.0%
add-sqr-sqrt15.5%
associate-*r/15.5%
Applied egg-rr0.0%
Simplified42.1%
associate-*r/42.1%
cbrt-div60.5%
Applied egg-rr0.0%
Simplified4.9%
Final simplification4.9%
(FPCore (g h a) :precision binary64 -1.0)
double code(double g, double h, double a) {
return -1.0;
}
real(8) function code(g, h, a)
real(8), intent (in) :: g
real(8), intent (in) :: h
real(8), intent (in) :: a
code = -1.0d0
end function
public static double code(double g, double h, double a) {
return -1.0;
}
def code(g, h, a): return -1.0
function code(g, h, a) return -1.0 end
function tmp = code(g, h, a) tmp = -1.0; end
code[g_, h_, a_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 45.9%
Simplified45.9%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around inf 15.5%
add-sqr-sqrt8.0%
sqrt-unprod15.4%
*-commutative15.4%
*-commutative15.4%
swap-sqr18.0%
*-commutative18.0%
*-commutative18.0%
swap-sqr18.0%
metadata-eval18.0%
metadata-eval18.0%
swap-sqr18.0%
count-218.0%
count-218.0%
frac-times18.0%
metadata-eval18.0%
metadata-eval18.0%
frac-times18.0%
swap-sqr15.4%
sqrt-unprod8.0%
add-sqr-sqrt15.5%
associate-*r/15.5%
Applied egg-rr0.0%
Simplified42.1%
Applied egg-rr4.3%
Final simplification4.3%
(FPCore (g h a) :precision binary64 1.0)
double code(double g, double h, double a) {
return 1.0;
}
real(8) function code(g, h, a)
real(8), intent (in) :: g
real(8), intent (in) :: h
real(8), intent (in) :: a
code = 1.0d0
end function
public static double code(double g, double h, double a) {
return 1.0;
}
def code(g, h, a): return 1.0
function code(g, h, a) return 1.0 end
function tmp = code(g, h, a) tmp = 1.0; end
code[g_, h_, a_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 45.9%
Simplified45.9%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around inf 15.5%
add-sqr-sqrt8.0%
sqrt-unprod15.4%
*-commutative15.4%
*-commutative15.4%
swap-sqr18.0%
*-commutative18.0%
*-commutative18.0%
swap-sqr18.0%
metadata-eval18.0%
metadata-eval18.0%
swap-sqr18.0%
count-218.0%
count-218.0%
frac-times18.0%
metadata-eval18.0%
metadata-eval18.0%
frac-times18.0%
swap-sqr15.4%
sqrt-unprod8.0%
add-sqr-sqrt15.5%
associate-*r/15.5%
Applied egg-rr0.0%
Simplified42.1%
Applied egg-rr4.7%
Final simplification4.7%
herbie shell --seed 2024080
(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))))))))