
(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 9 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 -1.0)))
double code(double g, double h, double a) {
return (cbrt(g) / cbrt(a)) * cbrt(-1.0);
}
public static double code(double g, double h, double a) {
return (Math.cbrt(g) / Math.cbrt(a)) * Math.cbrt(-1.0);
}
function code(g, h, a) return Float64(Float64(cbrt(g) / cbrt(a)) * cbrt(-1.0)) end
code[g_, h_, a_] := 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}
\\
\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot \sqrt[3]{-1}
\end{array}
Initial program 43.3%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6426.6
Simplified26.6%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6478.0
Simplified78.0%
cbrt-divN/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
cbrt-lowering-cbrt.f6495.0
Applied egg-rr95.0%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (/ 1.0 (* a 2.0))))
(if (<= t_0 -4e+116)
(/ (cbrt g) (pow (- 0.0 a) 0.3333333333333333))
(if (<= t_0 5e+115)
(cbrt (* g (/ -1.0 a)))
(/ (pow (- 0.0 g) 0.3333333333333333) (cbrt a))))))
double code(double g, double h, double a) {
double t_0 = 1.0 / (a * 2.0);
double tmp;
if (t_0 <= -4e+116) {
tmp = cbrt(g) / pow((0.0 - a), 0.3333333333333333);
} else if (t_0 <= 5e+115) {
tmp = cbrt((g * (-1.0 / a)));
} else {
tmp = pow((0.0 - g), 0.3333333333333333) / cbrt(a);
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = 1.0 / (a * 2.0);
double tmp;
if (t_0 <= -4e+116) {
tmp = Math.cbrt(g) / Math.pow((0.0 - a), 0.3333333333333333);
} else if (t_0 <= 5e+115) {
tmp = Math.cbrt((g * (-1.0 / a)));
} else {
tmp = Math.pow((0.0 - g), 0.3333333333333333) / Math.cbrt(a);
}
return tmp;
}
function code(g, h, a) t_0 = Float64(1.0 / Float64(a * 2.0)) tmp = 0.0 if (t_0 <= -4e+116) tmp = Float64(cbrt(g) / (Float64(0.0 - a) ^ 0.3333333333333333)); elseif (t_0 <= 5e+115) tmp = cbrt(Float64(g * Float64(-1.0 / a))); else tmp = Float64((Float64(0.0 - g) ^ 0.3333333333333333) / cbrt(a)); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e+116], N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[N[(0.0 - a), $MachinePrecision], 0.3333333333333333], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+115], N[Power[N[(g * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], N[(N[Power[N[(0.0 - g), $MachinePrecision], 0.3333333333333333], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{a \cdot 2}\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{+116}:\\
\;\;\;\;\frac{\sqrt[3]{g}}{{\left(0 - a\right)}^{0.3333333333333333}}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\sqrt[3]{g \cdot \frac{-1}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(0 - g\right)}^{0.3333333333333333}}{\sqrt[3]{a}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) < -4.00000000000000006e116Initial program 42.8%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6422.9
Simplified22.9%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6448.1
Simplified48.1%
*-commutativeN/A
cbrt-unprodN/A
neg-mul-1N/A
distribute-neg-frac2N/A
sub0-negN/A
cbrt-divN/A
unpow1/3N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
pow-lowering-pow.f64N/A
--lowering--.f6486.1
Applied egg-rr86.1%
if -4.00000000000000006e116 < (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) < 5.00000000000000008e115Initial program 45.6%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6430.2
Simplified30.2%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6491.7
Simplified91.7%
*-commutativeN/A
cbrt-unprodN/A
neg-mul-1N/A
sub0-negN/A
cbrt-lowering-cbrt.f64N/A
--lowering--.f64N/A
/-lowering-/.f6491.7
Applied egg-rr91.7%
sub0-negN/A
div-invN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f6491.8
Applied egg-rr91.8%
if 5.00000000000000008e115 < (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) Initial program 30.9%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6410.2
Simplified10.2%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6433.6
Simplified33.6%
*-commutativeN/A
cbrt-unprodN/A
neg-mul-1N/A
distribute-neg-fracN/A
cbrt-divN/A
pow1/3N/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
neg-sub0N/A
--lowering--.f64N/A
cbrt-lowering-cbrt.f6459.1
Applied egg-rr59.1%
Final simplification86.8%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (/ 1.0 (* a 2.0))))
(if (<= t_0 -4e+116)
(/ (cbrt g) (pow (- 0.0 a) 0.3333333333333333))
(if (<= t_0 5e+115)
(cbrt (* g (/ -1.0 a)))
(* (pow (- 0.0 g) 0.3333333333333333) (pow a -0.3333333333333333))))))
double code(double g, double h, double a) {
double t_0 = 1.0 / (a * 2.0);
double tmp;
if (t_0 <= -4e+116) {
tmp = cbrt(g) / pow((0.0 - a), 0.3333333333333333);
} else if (t_0 <= 5e+115) {
tmp = cbrt((g * (-1.0 / a)));
} else {
tmp = pow((0.0 - g), 0.3333333333333333) * pow(a, -0.3333333333333333);
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = 1.0 / (a * 2.0);
double tmp;
if (t_0 <= -4e+116) {
tmp = Math.cbrt(g) / Math.pow((0.0 - a), 0.3333333333333333);
} else if (t_0 <= 5e+115) {
tmp = Math.cbrt((g * (-1.0 / a)));
} else {
tmp = Math.pow((0.0 - g), 0.3333333333333333) * Math.pow(a, -0.3333333333333333);
}
return tmp;
}
function code(g, h, a) t_0 = Float64(1.0 / Float64(a * 2.0)) tmp = 0.0 if (t_0 <= -4e+116) tmp = Float64(cbrt(g) / (Float64(0.0 - a) ^ 0.3333333333333333)); elseif (t_0 <= 5e+115) tmp = cbrt(Float64(g * Float64(-1.0 / a))); else tmp = Float64((Float64(0.0 - g) ^ 0.3333333333333333) * (a ^ -0.3333333333333333)); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e+116], N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[N[(0.0 - a), $MachinePrecision], 0.3333333333333333], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+115], N[Power[N[(g * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], N[(N[Power[N[(0.0 - g), $MachinePrecision], 0.3333333333333333], $MachinePrecision] * N[Power[a, -0.3333333333333333], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{a \cdot 2}\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{+116}:\\
\;\;\;\;\frac{\sqrt[3]{g}}{{\left(0 - a\right)}^{0.3333333333333333}}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\sqrt[3]{g \cdot \frac{-1}{a}}\\
\mathbf{else}:\\
\;\;\;\;{\left(0 - g\right)}^{0.3333333333333333} \cdot {a}^{-0.3333333333333333}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) < -4.00000000000000006e116Initial program 42.8%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6422.9
Simplified22.9%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6448.1
Simplified48.1%
*-commutativeN/A
cbrt-unprodN/A
neg-mul-1N/A
distribute-neg-frac2N/A
sub0-negN/A
cbrt-divN/A
unpow1/3N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
pow-lowering-pow.f64N/A
--lowering--.f6486.1
Applied egg-rr86.1%
if -4.00000000000000006e116 < (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) < 5.00000000000000008e115Initial program 45.6%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6430.2
Simplified30.2%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6491.7
Simplified91.7%
*-commutativeN/A
cbrt-unprodN/A
neg-mul-1N/A
sub0-negN/A
cbrt-lowering-cbrt.f64N/A
--lowering--.f64N/A
/-lowering-/.f6491.7
Applied egg-rr91.7%
sub0-negN/A
div-invN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f6491.8
Applied egg-rr91.8%
if 5.00000000000000008e115 < (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) Initial program 30.9%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6410.2
Simplified10.2%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6433.6
Simplified33.6%
*-commutativeN/A
pow1/3N/A
pow1/3N/A
pow-prod-downN/A
neg-mul-1N/A
div-invN/A
distribute-lft-neg-inN/A
unpow-prod-downN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
neg-sub0N/A
--lowering--.f64N/A
inv-powN/A
pow-powN/A
metadata-evalN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
metadata-eval58.0
Applied egg-rr58.0%
Final simplification86.7%
(FPCore (g h a) :precision binary64 (if (<= (/ 1.0 (* a 2.0)) 5e+115) (cbrt (/ (/ 1.0 a) (/ -1.0 g))) (* (pow (- 0.0 g) 0.3333333333333333) (pow a -0.3333333333333333))))
double code(double g, double h, double a) {
double tmp;
if ((1.0 / (a * 2.0)) <= 5e+115) {
tmp = cbrt(((1.0 / a) / (-1.0 / g)));
} else {
tmp = pow((0.0 - g), 0.3333333333333333) * pow(a, -0.3333333333333333);
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((1.0 / (a * 2.0)) <= 5e+115) {
tmp = Math.cbrt(((1.0 / a) / (-1.0 / g)));
} else {
tmp = Math.pow((0.0 - g), 0.3333333333333333) * Math.pow(a, -0.3333333333333333);
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if (Float64(1.0 / Float64(a * 2.0)) <= 5e+115) tmp = cbrt(Float64(Float64(1.0 / a) / Float64(-1.0 / g))); else tmp = Float64((Float64(0.0 - g) ^ 0.3333333333333333) * (a ^ -0.3333333333333333)); end return tmp end
code[g_, h_, a_] := If[LessEqual[N[(1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], 5e+115], N[Power[N[(N[(1.0 / a), $MachinePrecision] / N[(-1.0 / g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], N[(N[Power[N[(0.0 - g), $MachinePrecision], 0.3333333333333333], $MachinePrecision] * N[Power[a, -0.3333333333333333], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{a \cdot 2} \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\sqrt[3]{\frac{\frac{1}{a}}{\frac{-1}{g}}}\\
\mathbf{else}:\\
\;\;\;\;{\left(0 - g\right)}^{0.3333333333333333} \cdot {a}^{-0.3333333333333333}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) < 5.00000000000000008e115Initial program 45.1%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6429.0
Simplified29.0%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6484.3
Simplified84.3%
*-commutativeN/A
cbrt-unprodN/A
neg-mul-1N/A
sub0-negN/A
cbrt-lowering-cbrt.f64N/A
--lowering--.f64N/A
/-lowering-/.f6484.3
Applied egg-rr84.3%
clear-numN/A
div-invN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6484.4
Applied egg-rr84.4%
if 5.00000000000000008e115 < (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) Initial program 30.9%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6410.2
Simplified10.2%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6433.6
Simplified33.6%
*-commutativeN/A
pow1/3N/A
pow1/3N/A
pow-prod-downN/A
neg-mul-1N/A
div-invN/A
distribute-lft-neg-inN/A
unpow-prod-downN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
neg-sub0N/A
--lowering--.f64N/A
inv-powN/A
pow-powN/A
metadata-evalN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
metadata-eval58.0
Applied egg-rr58.0%
Final simplification81.1%
(FPCore (g h a) :precision binary64 (* (cbrt g) (cbrt (/ -1.0 a))))
double code(double g, double h, double a) {
return cbrt(g) * cbrt((-1.0 / a));
}
public static double code(double g, double h, double a) {
return Math.cbrt(g) * Math.cbrt((-1.0 / a));
}
function code(g, h, a) return Float64(cbrt(g) * cbrt(Float64(-1.0 / a))) end
code[g_, h_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[N[(-1.0 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{g} \cdot \sqrt[3]{\frac{-1}{a}}
\end{array}
Initial program 43.3%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6426.6
Simplified26.6%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6478.0
Simplified78.0%
cbrt-divN/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
cbrt-lowering-cbrt.f6495.0
Applied egg-rr95.0%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
cbrt-undivN/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f6495.0
Applied egg-rr95.0%
(FPCore (g h a) :precision binary64 (cbrt (/ (/ 1.0 a) (/ -1.0 g))))
double code(double g, double h, double a) {
return cbrt(((1.0 / a) / (-1.0 / g)));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((1.0 / a) / (-1.0 / g)));
}
function code(g, h, a) return cbrt(Float64(Float64(1.0 / a) / Float64(-1.0 / g))) end
code[g_, h_, a_] := N[Power[N[(N[(1.0 / a), $MachinePrecision] / N[(-1.0 / g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{\frac{1}{a}}{\frac{-1}{g}}}
\end{array}
Initial program 43.3%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6426.6
Simplified26.6%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6478.0
Simplified78.0%
*-commutativeN/A
cbrt-unprodN/A
neg-mul-1N/A
sub0-negN/A
cbrt-lowering-cbrt.f64N/A
--lowering--.f64N/A
/-lowering-/.f6478.0
Applied egg-rr78.0%
clear-numN/A
div-invN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6478.0
Applied egg-rr78.0%
Final simplification78.0%
(FPCore (g h a) :precision binary64 (cbrt (* g (/ -1.0 a))))
double code(double g, double h, double a) {
return cbrt((g * (-1.0 / a)));
}
public static double code(double g, double h, double a) {
return Math.cbrt((g * (-1.0 / a)));
}
function code(g, h, a) return cbrt(Float64(g * Float64(-1.0 / a))) end
code[g_, h_, a_] := N[Power[N[(g * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{g \cdot \frac{-1}{a}}
\end{array}
Initial program 43.3%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6426.6
Simplified26.6%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6478.0
Simplified78.0%
*-commutativeN/A
cbrt-unprodN/A
neg-mul-1N/A
sub0-negN/A
cbrt-lowering-cbrt.f64N/A
--lowering--.f64N/A
/-lowering-/.f6478.0
Applied egg-rr78.0%
sub0-negN/A
div-invN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f6478.0
Applied egg-rr78.0%
Final simplification78.0%
(FPCore (g h a) :precision binary64 (cbrt (- 0.0 (/ g a))))
double code(double g, double h, double a) {
return cbrt((0.0 - (g / a)));
}
public static double code(double g, double h, double a) {
return Math.cbrt((0.0 - (g / a)));
}
function code(g, h, a) return cbrt(Float64(0.0 - Float64(g / a))) end
code[g_, h_, a_] := N[Power[N[(0.0 - N[(g / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{0 - \frac{g}{a}}
\end{array}
Initial program 43.3%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6426.6
Simplified26.6%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6478.0
Simplified78.0%
*-commutativeN/A
cbrt-unprodN/A
neg-mul-1N/A
sub0-negN/A
cbrt-lowering-cbrt.f64N/A
--lowering--.f64N/A
/-lowering-/.f6478.0
Applied egg-rr78.0%
flip3--N/A
metadata-evalN/A
sub0-negN/A
cube-negN/A
distribute-neg-fracN/A
cube-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
pow-prod-downN/A
sqr-negN/A
pow-prod-downN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
cube-divN/A
metadata-evalN/A
+-lft-identityN/A
distribute-rgt-outN/A
+-commutativeN/A
Applied egg-rr78.0%
Final simplification78.0%
(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 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 43.3%
Taylor expanded in g around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6426.6
Simplified26.6%
Taylor expanded in g around inf
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f6478.0
Simplified78.0%
cbrt-divN/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
cbrt-lowering-cbrt.f6495.0
Applied egg-rr95.0%
*-commutativeN/A
cbrt-undivN/A
cbrt-unprodN/A
neg-mul-1N/A
sub0-negN/A
cbrt-lowering-cbrt.f64N/A
flip3--N/A
Applied egg-rr1.4%
herbie shell --seed 2024198
(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))))))))