
(FPCore (g a) :precision binary64 (cbrt (/ g (* 2.0 a))))
double code(double g, double a) {
return cbrt((g / (2.0 * a)));
}
public static double code(double g, double a) {
return Math.cbrt((g / (2.0 * a)));
}
function code(g, a) return cbrt(Float64(g / Float64(2.0 * a))) end
code[g_, a_] := N[Power[N[(g / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{g}{2 \cdot a}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (g a) :precision binary64 (cbrt (/ g (* 2.0 a))))
double code(double g, double a) {
return cbrt((g / (2.0 * a)));
}
public static double code(double g, double a) {
return Math.cbrt((g / (2.0 * a)));
}
function code(g, a) return cbrt(Float64(g / Float64(2.0 * a))) end
code[g_, a_] := N[Power[N[(g / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{g}{2 \cdot a}}
\end{array}
(FPCore (g a) :precision binary64 (* (cbrt g) (cbrt (/ 0.5 a))))
double code(double g, double a) {
return cbrt(g) * cbrt((0.5 / a));
}
public static double code(double g, double a) {
return Math.cbrt(g) * Math.cbrt((0.5 / a));
}
function code(g, a) return Float64(cbrt(g) * cbrt(Float64(0.5 / a))) end
code[g_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{g} \cdot \sqrt[3]{\frac{0.5}{a}}
\end{array}
Initial program 75.0%
associate-/r*N/A
cbrt-divN/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
cbrt-lowering-cbrt.f6498.7
Applied egg-rr98.7%
clear-numN/A
associate-/r/N/A
metadata-evalN/A
cbrt-divN/A
metadata-evalN/A
div-invN/A
clear-numN/A
cbrt-prodN/A
div-invN/A
frac-2negN/A
associate-/r/N/A
cbrt-prodN/A
pow1/3N/A
*-lowering-*.f64N/A
Applied egg-rr98.8%
frac-2negN/A
metadata-evalN/A
div-invN/A
cbrt-prodN/A
pow1/3N/A
distribute-frac-neg2N/A
*-lowering-*.f64N/A
pow1/3N/A
cbrt-lowering-cbrt.f64N/A
distribute-frac-neg2N/A
cbrt-lowering-cbrt.f64N/A
metadata-evalN/A
frac-2negN/A
/-lowering-/.f6498.7
Applied egg-rr98.7%
*-commutativeN/A
cbrt-unprodN/A
associate-*l/N/A
metadata-evalN/A
clear-numN/A
cbrt-divN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
associate-/r/N/A
metadata-evalN/A
cbrt-divN/A
frac-2negN/A
cbrt-divN/A
clear-numN/A
div-invN/A
cbrt-prodN/A
*-lowering-*.f64N/A
cbrt-lowering-cbrt.f64N/A
Applied egg-rr98.8%
(FPCore (g a) :precision binary64 (if (<= (* a 2.0) -2e-304) (* (pow (- a) -0.3333333333333333) (cbrt (* g -0.5))) (* (pow a -0.3333333333333333) (cbrt (* g 0.5)))))
double code(double g, double a) {
double tmp;
if ((a * 2.0) <= -2e-304) {
tmp = pow(-a, -0.3333333333333333) * cbrt((g * -0.5));
} else {
tmp = pow(a, -0.3333333333333333) * cbrt((g * 0.5));
}
return tmp;
}
public static double code(double g, double a) {
double tmp;
if ((a * 2.0) <= -2e-304) {
tmp = Math.pow(-a, -0.3333333333333333) * Math.cbrt((g * -0.5));
} else {
tmp = Math.pow(a, -0.3333333333333333) * Math.cbrt((g * 0.5));
}
return tmp;
}
function code(g, a) tmp = 0.0 if (Float64(a * 2.0) <= -2e-304) tmp = Float64((Float64(-a) ^ -0.3333333333333333) * cbrt(Float64(g * -0.5))); else tmp = Float64((a ^ -0.3333333333333333) * cbrt(Float64(g * 0.5))); end return tmp end
code[g_, a_] := If[LessEqual[N[(a * 2.0), $MachinePrecision], -2e-304], N[(N[Power[(-a), -0.3333333333333333], $MachinePrecision] * N[Power[N[(g * -0.5), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[a, -0.3333333333333333], $MachinePrecision] * N[Power[N[(g * 0.5), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq -2 \cdot 10^{-304}:\\
\;\;\;\;{\left(-a\right)}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot -0.5}\\
\mathbf{else}:\\
\;\;\;\;{a}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot 0.5}\\
\end{array}
\end{array}
if (*.f64 #s(literal 2 binary64) a) < -1.99999999999999994e-304Initial program 69.4%
associate-/r*N/A
cbrt-divN/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
cbrt-lowering-cbrt.f6498.7
Applied egg-rr98.7%
cbrt-undivN/A
*-commutativeN/A
associate-*l/N/A
pow1/3N/A
associate-*l/N/A
*-commutativeN/A
frac-2negN/A
metadata-evalN/A
div-invN/A
div-invN/A
distribute-neg-frac2N/A
*-commutativeN/A
pow-prod-downN/A
pow1/3N/A
*-lowering-*.f64N/A
distribute-neg-frac2N/A
inv-powN/A
pow-powN/A
metadata-evalN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
neg-lowering-neg.f64N/A
metadata-evalN/A
cbrt-lowering-cbrt.f64N/A
Applied egg-rr92.1%
if -1.99999999999999994e-304 < (*.f64 #s(literal 2 binary64) a) Initial program 80.8%
associate-/r*N/A
div-invN/A
cbrt-prodN/A
pow1/3N/A
*-commutativeN/A
*-lowering-*.f64N/A
inv-powN/A
pow-powN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
cbrt-lowering-cbrt.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval92.2
Applied egg-rr92.2%
Final simplification92.2%
(FPCore (g a)
:precision binary64
(let* ((t_0 (/ g (* a 2.0)))
(t_1 (sqrt (/ (* g -0.5) a)))
(t_2 (/ (cbrt (* 0.5 (* a (* g a)))) a)))
(if (<= t_0 (- INFINITY))
t_2
(if (<= t_0 -1e-321)
(cbrt (- (* t_1 t_1)))
(if (<= t_0 1e-312)
t_2
(if (<= t_0 1e+295) (/ 1.0 (cbrt (/ (* a 2.0) g))) t_2))))))
double code(double g, double a) {
double t_0 = g / (a * 2.0);
double t_1 = sqrt(((g * -0.5) / a));
double t_2 = cbrt((0.5 * (a * (g * a)))) / a;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_0 <= -1e-321) {
tmp = cbrt(-(t_1 * t_1));
} else if (t_0 <= 1e-312) {
tmp = t_2;
} else if (t_0 <= 1e+295) {
tmp = 1.0 / cbrt(((a * 2.0) / g));
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double g, double a) {
double t_0 = g / (a * 2.0);
double t_1 = Math.sqrt(((g * -0.5) / a));
double t_2 = Math.cbrt((0.5 * (a * (g * a)))) / a;
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_0 <= -1e-321) {
tmp = Math.cbrt(-(t_1 * t_1));
} else if (t_0 <= 1e-312) {
tmp = t_2;
} else if (t_0 <= 1e+295) {
tmp = 1.0 / Math.cbrt(((a * 2.0) / g));
} else {
tmp = t_2;
}
return tmp;
}
function code(g, a) t_0 = Float64(g / Float64(a * 2.0)) t_1 = sqrt(Float64(Float64(g * -0.5) / a)) t_2 = Float64(cbrt(Float64(0.5 * Float64(a * Float64(g * a)))) / a) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_2; elseif (t_0 <= -1e-321) tmp = cbrt(Float64(-Float64(t_1 * t_1))); elseif (t_0 <= 1e-312) tmp = t_2; elseif (t_0 <= 1e+295) tmp = Float64(1.0 / cbrt(Float64(Float64(a * 2.0) / g))); else tmp = t_2; end return tmp end
code[g_, a_] := Block[{t$95$0 = N[(g / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * -0.5), $MachinePrecision] / a), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(0.5 * N[(a * N[(g * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$2, If[LessEqual[t$95$0, -1e-321], N[Power[(-N[(t$95$1 * t$95$1), $MachinePrecision]), 1/3], $MachinePrecision], If[LessEqual[t$95$0, 1e-312], t$95$2, If[LessEqual[t$95$0, 1e+295], N[(1.0 / N[Power[N[(N[(a * 2.0), $MachinePrecision] / g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{g}{a \cdot 2}\\
t_1 := \sqrt{\frac{g \cdot -0.5}{a}}\\
t_2 := \frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-321}:\\
\;\;\;\;\sqrt[3]{-t\_1 \cdot t\_1}\\
\mathbf{elif}\;t\_0 \leq 10^{-312}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 10^{+295}:\\
\;\;\;\;\frac{1}{\sqrt[3]{\frac{a \cdot 2}{g}}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -inf.0 or -9.98013e-322 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999847e-313 or 9.9999999999999998e294 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) Initial program 5.7%
associate-/r*N/A
cbrt-divN/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
cbrt-lowering-cbrt.f6498.8
Applied egg-rr98.8%
Applied egg-rr66.3%
if -inf.0 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -9.98013e-322Initial program 98.4%
div-invN/A
inv-powN/A
sqr-powN/A
sqr-powN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
pow2N/A
remove-double-negN/A
remove-double-negN/A
sqr-negN/A
pow-prod-downN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
inv-powN/A
Applied egg-rr98.5%
if 9.9999999999847e-313 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999999998e294Initial program 98.9%
associate-/r*N/A
cbrt-divN/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
cbrt-lowering-cbrt.f6498.6
Applied egg-rr98.6%
clear-numN/A
/-lowering-/.f64N/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
cbrt-divN/A
clear-numN/A
cbrt-prodN/A
*-commutativeN/A
cbrt-lowering-cbrt.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6499.1
Applied egg-rr99.1%
Final simplification90.5%
(FPCore (g a)
:precision binary64
(let* ((t_0 (/ g (* a 2.0))) (t_1 (/ (cbrt (* 0.5 (* a (* g a)))) a)))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 -1e-321)
(cbrt t_0)
(if (<= t_0 1e-312)
t_1
(if (<= t_0 1e+295) (/ 1.0 (cbrt (/ (* a 2.0) g))) t_1))))))
double code(double g, double a) {
double t_0 = g / (a * 2.0);
double t_1 = cbrt((0.5 * (a * (g * a)))) / a;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= -1e-321) {
tmp = cbrt(t_0);
} else if (t_0 <= 1e-312) {
tmp = t_1;
} else if (t_0 <= 1e+295) {
tmp = 1.0 / cbrt(((a * 2.0) / g));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double g, double a) {
double t_0 = g / (a * 2.0);
double t_1 = Math.cbrt((0.5 * (a * (g * a)))) / a;
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_0 <= -1e-321) {
tmp = Math.cbrt(t_0);
} else if (t_0 <= 1e-312) {
tmp = t_1;
} else if (t_0 <= 1e+295) {
tmp = 1.0 / Math.cbrt(((a * 2.0) / g));
} else {
tmp = t_1;
}
return tmp;
}
function code(g, a) t_0 = Float64(g / Float64(a * 2.0)) t_1 = Float64(cbrt(Float64(0.5 * Float64(a * Float64(g * a)))) / a) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_1; elseif (t_0 <= -1e-321) tmp = cbrt(t_0); elseif (t_0 <= 1e-312) tmp = t_1; elseif (t_0 <= 1e+295) tmp = Float64(1.0 / cbrt(Float64(Float64(a * 2.0) / g))); else tmp = t_1; end return tmp end
code[g_, a_] := Block[{t$95$0 = N[(g / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(0.5 * N[(a * N[(g * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, -1e-321], N[Power[t$95$0, 1/3], $MachinePrecision], If[LessEqual[t$95$0, 1e-312], t$95$1, If[LessEqual[t$95$0, 1e+295], N[(1.0 / N[Power[N[(N[(a * 2.0), $MachinePrecision] / g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{g}{a \cdot 2}\\
t_1 := \frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-321}:\\
\;\;\;\;\sqrt[3]{t\_0}\\
\mathbf{elif}\;t\_0 \leq 10^{-312}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+295}:\\
\;\;\;\;\frac{1}{\sqrt[3]{\frac{a \cdot 2}{g}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -inf.0 or -9.98013e-322 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999847e-313 or 9.9999999999999998e294 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) Initial program 5.7%
associate-/r*N/A
cbrt-divN/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
cbrt-lowering-cbrt.f6498.8
Applied egg-rr98.8%
Applied egg-rr66.3%
if -inf.0 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -9.98013e-322Initial program 98.4%
if 9.9999999999847e-313 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999999998e294Initial program 98.9%
associate-/r*N/A
cbrt-divN/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
cbrt-lowering-cbrt.f6498.6
Applied egg-rr98.6%
clear-numN/A
/-lowering-/.f64N/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
cbrt-divN/A
clear-numN/A
cbrt-prodN/A
*-commutativeN/A
cbrt-lowering-cbrt.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6499.1
Applied egg-rr99.1%
Final simplification90.5%
(FPCore (g a)
:precision binary64
(let* ((t_0 (/ g (* a 2.0))) (t_1 (/ (cbrt (* 0.5 (* a (* g a)))) a)))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 -1e-321)
(cbrt t_0)
(if (<= t_0 1e-312)
t_1
(if (<= t_0 1e+295) (/ 1.0 (cbrt (* a (/ 2.0 g)))) t_1))))))
double code(double g, double a) {
double t_0 = g / (a * 2.0);
double t_1 = cbrt((0.5 * (a * (g * a)))) / a;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= -1e-321) {
tmp = cbrt(t_0);
} else if (t_0 <= 1e-312) {
tmp = t_1;
} else if (t_0 <= 1e+295) {
tmp = 1.0 / cbrt((a * (2.0 / g)));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double g, double a) {
double t_0 = g / (a * 2.0);
double t_1 = Math.cbrt((0.5 * (a * (g * a)))) / a;
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_0 <= -1e-321) {
tmp = Math.cbrt(t_0);
} else if (t_0 <= 1e-312) {
tmp = t_1;
} else if (t_0 <= 1e+295) {
tmp = 1.0 / Math.cbrt((a * (2.0 / g)));
} else {
tmp = t_1;
}
return tmp;
}
function code(g, a) t_0 = Float64(g / Float64(a * 2.0)) t_1 = Float64(cbrt(Float64(0.5 * Float64(a * Float64(g * a)))) / a) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_1; elseif (t_0 <= -1e-321) tmp = cbrt(t_0); elseif (t_0 <= 1e-312) tmp = t_1; elseif (t_0 <= 1e+295) tmp = Float64(1.0 / cbrt(Float64(a * Float64(2.0 / g)))); else tmp = t_1; end return tmp end
code[g_, a_] := Block[{t$95$0 = N[(g / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(0.5 * N[(a * N[(g * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, -1e-321], N[Power[t$95$0, 1/3], $MachinePrecision], If[LessEqual[t$95$0, 1e-312], t$95$1, If[LessEqual[t$95$0, 1e+295], N[(1.0 / N[Power[N[(a * N[(2.0 / g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{g}{a \cdot 2}\\
t_1 := \frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-321}:\\
\;\;\;\;\sqrt[3]{t\_0}\\
\mathbf{elif}\;t\_0 \leq 10^{-312}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+295}:\\
\;\;\;\;\frac{1}{\sqrt[3]{a \cdot \frac{2}{g}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -inf.0 or -9.98013e-322 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999847e-313 or 9.9999999999999998e294 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) Initial program 5.7%
associate-/r*N/A
cbrt-divN/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
cbrt-lowering-cbrt.f6498.8
Applied egg-rr98.8%
Applied egg-rr66.3%
if -inf.0 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -9.98013e-322Initial program 98.4%
if 9.9999999999847e-313 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999999998e294Initial program 98.9%
associate-/r*N/A
cbrt-divN/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
cbrt-lowering-cbrt.f6498.6
Applied egg-rr98.6%
clear-numN/A
/-lowering-/.f64N/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
cbrt-divN/A
clear-numN/A
cbrt-prodN/A
*-commutativeN/A
cbrt-lowering-cbrt.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6499.1
Applied egg-rr99.1%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6499.1
Applied egg-rr99.1%
Final simplification90.5%
(FPCore (g a)
:precision binary64
(let* ((t_0 (/ (cbrt (* 0.5 (* a (* g a)))) a))
(t_1 (/ g (* a 2.0)))
(t_2 (cbrt t_1)))
(if (<= t_1 (- INFINITY))
t_0
(if (<= t_1 -1e-321)
t_2
(if (<= t_1 1e-312) t_0 (if (<= t_1 1e+295) t_2 t_0))))))
double code(double g, double a) {
double t_0 = cbrt((0.5 * (a * (g * a)))) / a;
double t_1 = g / (a * 2.0);
double t_2 = cbrt(t_1);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_0;
} else if (t_1 <= -1e-321) {
tmp = t_2;
} else if (t_1 <= 1e-312) {
tmp = t_0;
} else if (t_1 <= 1e+295) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double g, double a) {
double t_0 = Math.cbrt((0.5 * (a * (g * a)))) / a;
double t_1 = g / (a * 2.0);
double t_2 = Math.cbrt(t_1);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t_0;
} else if (t_1 <= -1e-321) {
tmp = t_2;
} else if (t_1 <= 1e-312) {
tmp = t_0;
} else if (t_1 <= 1e+295) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
function code(g, a) t_0 = Float64(cbrt(Float64(0.5 * Float64(a * Float64(g * a)))) / a) t_1 = Float64(g / Float64(a * 2.0)) t_2 = cbrt(t_1) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_0; elseif (t_1 <= -1e-321) tmp = t_2; elseif (t_1 <= 1e-312) tmp = t_0; elseif (t_1 <= 1e+295) tmp = t_2; else tmp = t_0; end return tmp end
code[g_, a_] := Block[{t$95$0 = N[(N[Power[N[(0.5 * N[(a * N[(g * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$1 = N[(g / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 1/3], $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$0, If[LessEqual[t$95$1, -1e-321], t$95$2, If[LessEqual[t$95$1, 1e-312], t$95$0, If[LessEqual[t$95$1, 1e+295], t$95$2, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\
t_1 := \frac{g}{a \cdot 2}\\
t_2 := \sqrt[3]{t\_1}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-321}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{-312}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{+295}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -inf.0 or -9.98013e-322 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999847e-313 or 9.9999999999999998e294 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) Initial program 5.7%
associate-/r*N/A
cbrt-divN/A
/-lowering-/.f64N/A
cbrt-lowering-cbrt.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
cbrt-lowering-cbrt.f6498.8
Applied egg-rr98.8%
Applied egg-rr66.3%
if -inf.0 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -9.98013e-322 or 9.9999999999847e-313 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999999998e294Initial program 98.6%
Final simplification90.4%
(FPCore (g a) :precision binary64 (cbrt (/ g (* a 2.0))))
double code(double g, double a) {
return cbrt((g / (a * 2.0)));
}
public static double code(double g, double a) {
return Math.cbrt((g / (a * 2.0)));
}
function code(g, a) return cbrt(Float64(g / Float64(a * 2.0))) end
code[g_, a_] := N[Power[N[(g / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{g}{a \cdot 2}}
\end{array}
Initial program 75.0%
Final simplification75.0%
(FPCore (g a) :precision binary64 (cbrt (* g (/ 0.5 a))))
double code(double g, double a) {
return cbrt((g * (0.5 / a)));
}
public static double code(double g, double a) {
return Math.cbrt((g * (0.5 / a)));
}
function code(g, a) return cbrt(Float64(g * Float64(0.5 / a))) end
code[g_, a_] := N[Power[N[(g * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{g \cdot \frac{0.5}{a}}
\end{array}
Initial program 75.0%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-eval75.0
Applied egg-rr75.0%
Final simplification75.0%
herbie shell --seed 2024205
(FPCore (g a)
:name "2-ancestry mixing, zero discriminant"
:precision binary64
(cbrt (/ g (* 2.0 a))))