
(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 11 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 0.5)) (cbrt a)))
double code(double g, double a) {
return cbrt((g * 0.5)) / cbrt(a);
}
public static double code(double g, double a) {
return Math.cbrt((g * 0.5)) / Math.cbrt(a);
}
function code(g, a) return Float64(cbrt(Float64(g * 0.5)) / cbrt(a)) end
code[g_, a_] := N[(N[Power[N[(g * 0.5), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt[3]{g \cdot 0.5}}{\sqrt[3]{a}}
\end{array}
Initial program 78.2%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.8
Applied rewrites98.8%
(FPCore (g a)
:precision binary64
(let* ((t_0 (/ g (* a 2.0))) (t_1 (/ 1.0 (/ a (cbrt (* a (* g (* 0.5 a))))))))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 -5e-306)
(cbrt (/ (/ g a) (* (/ 0.5 a) (* a 4.0))))
(if (<= t_0 2e-310)
t_1
(if (<= t_0 2e+302) (/ 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 = 1.0 / (a / cbrt((a * (g * (0.5 * a)))));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= -5e-306) {
tmp = cbrt(((g / a) / ((0.5 / a) * (a * 4.0))));
} else if (t_0 <= 2e-310) {
tmp = t_1;
} else if (t_0 <= 2e+302) {
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 = 1.0 / (a / Math.cbrt((a * (g * (0.5 * a)))));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_0 <= -5e-306) {
tmp = Math.cbrt(((g / a) / ((0.5 / a) * (a * 4.0))));
} else if (t_0 <= 2e-310) {
tmp = t_1;
} else if (t_0 <= 2e+302) {
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(1.0 / Float64(a / cbrt(Float64(a * Float64(g * Float64(0.5 * a)))))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_1; elseif (t_0 <= -5e-306) tmp = cbrt(Float64(Float64(g / a) / Float64(Float64(0.5 / a) * Float64(a * 4.0)))); elseif (t_0 <= 2e-310) tmp = t_1; elseif (t_0 <= 2e+302) 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[(1.0 / N[(a / N[Power[N[(a * N[(g * N[(0.5 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, -5e-306], N[Power[N[(N[(g / a), $MachinePrecision] / N[(N[(0.5 / a), $MachinePrecision] * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], If[LessEqual[t$95$0, 2e-310], t$95$1, If[LessEqual[t$95$0, 2e+302], 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{1}{\frac{a}{\sqrt[3]{a \cdot \left(g \cdot \left(0.5 \cdot a\right)\right)}}}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq -5 \cdot 10^{-306}:\\
\;\;\;\;\sqrt[3]{\frac{\frac{g}{a}}{\frac{0.5}{a} \cdot \left(a \cdot 4\right)}}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-310}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;\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 -4.99999999999999998e-306 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 1.999999999999994e-310 or 2.0000000000000002e302 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) Initial program 8.6%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.7
Applied rewrites98.7%
Applied rewrites98.6%
Applied rewrites32.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
if -inf.0 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -4.99999999999999998e-306Initial program 99.1%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval99.1
Applied rewrites99.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
metadata-evalN/A
metadata-evalN/A
*-inversesN/A
times-fracN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l/N/A
times-fracN/A
associate-/r*N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
metadata-evalN/A
associate-/r/N/A
lift-/.f64N/A
frac-timesN/A
*-lft-identityN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6499.1
Applied rewrites99.1%
if 1.999999999999994e-310 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 2.0000000000000002e302Initial program 98.8%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.8
Applied rewrites98.8%
Applied rewrites98.8%
Applied rewrites51.3%
Applied rewrites99.1%
Final simplification94.1%
(FPCore (g a)
:precision binary64
(let* ((t_0 (/ g (* a 2.0))) (t_1 (/ 1.0 (/ a (cbrt (* a (* g (* 0.5 a))))))))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 -5e-306)
(cbrt t_0)
(if (<= t_0 2e-310)
t_1
(if (<= t_0 2e+302) (/ 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 = 1.0 / (a / cbrt((a * (g * (0.5 * a)))));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= -5e-306) {
tmp = cbrt(t_0);
} else if (t_0 <= 2e-310) {
tmp = t_1;
} else if (t_0 <= 2e+302) {
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 = 1.0 / (a / Math.cbrt((a * (g * (0.5 * a)))));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_0 <= -5e-306) {
tmp = Math.cbrt(t_0);
} else if (t_0 <= 2e-310) {
tmp = t_1;
} else if (t_0 <= 2e+302) {
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(1.0 / Float64(a / cbrt(Float64(a * Float64(g * Float64(0.5 * a)))))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_1; elseif (t_0 <= -5e-306) tmp = cbrt(t_0); elseif (t_0 <= 2e-310) tmp = t_1; elseif (t_0 <= 2e+302) 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[(1.0 / N[(a / N[Power[N[(a * N[(g * N[(0.5 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, -5e-306], N[Power[t$95$0, 1/3], $MachinePrecision], If[LessEqual[t$95$0, 2e-310], t$95$1, If[LessEqual[t$95$0, 2e+302], 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{1}{\frac{a}{\sqrt[3]{a \cdot \left(g \cdot \left(0.5 \cdot a\right)\right)}}}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq -5 \cdot 10^{-306}:\\
\;\;\;\;\sqrt[3]{t\_0}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-310}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;\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 -4.99999999999999998e-306 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 1.999999999999994e-310 or 2.0000000000000002e302 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) Initial program 8.6%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.7
Applied rewrites98.7%
Applied rewrites98.6%
Applied rewrites32.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
if -inf.0 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -4.99999999999999998e-306Initial program 99.1%
if 1.999999999999994e-310 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 2.0000000000000002e302Initial program 98.8%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.8
Applied rewrites98.8%
Applied rewrites98.8%
Applied rewrites51.3%
Applied rewrites99.1%
Final simplification94.1%
(FPCore (g a) :precision binary64 (if (<= (* a 2.0) -1e-299) (* (cbrt (- g)) (pow (* a -2.0) -0.3333333333333333)) (* (cbrt g) (pow (* a 2.0) -0.3333333333333333))))
double code(double g, double a) {
double tmp;
if ((a * 2.0) <= -1e-299) {
tmp = cbrt(-g) * pow((a * -2.0), -0.3333333333333333);
} else {
tmp = cbrt(g) * pow((a * 2.0), -0.3333333333333333);
}
return tmp;
}
public static double code(double g, double a) {
double tmp;
if ((a * 2.0) <= -1e-299) {
tmp = Math.cbrt(-g) * Math.pow((a * -2.0), -0.3333333333333333);
} else {
tmp = Math.cbrt(g) * Math.pow((a * 2.0), -0.3333333333333333);
}
return tmp;
}
function code(g, a) tmp = 0.0 if (Float64(a * 2.0) <= -1e-299) tmp = Float64(cbrt(Float64(-g)) * (Float64(a * -2.0) ^ -0.3333333333333333)); else tmp = Float64(cbrt(g) * (Float64(a * 2.0) ^ -0.3333333333333333)); end return tmp end
code[g_, a_] := If[LessEqual[N[(a * 2.0), $MachinePrecision], -1e-299], N[(N[Power[(-g), 1/3], $MachinePrecision] * N[Power[N[(a * -2.0), $MachinePrecision], -0.3333333333333333], $MachinePrecision]), $MachinePrecision], N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[N[(a * 2.0), $MachinePrecision], -0.3333333333333333], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq -1 \cdot 10^{-299}:\\
\;\;\;\;\sqrt[3]{-g} \cdot {\left(a \cdot -2\right)}^{-0.3333333333333333}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{g} \cdot {\left(a \cdot 2\right)}^{-0.3333333333333333}\\
\end{array}
\end{array}
if (*.f64 #s(literal 2 binary64) a) < -9.99999999999999992e-300Initial program 82.3%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.9
Applied rewrites98.9%
Applied rewrites98.8%
lift-/.f64N/A
lift-cbrt.f64N/A
pow1/3N/A
pow-flipN/A
metadata-evalN/A
lower-pow.f6492.2
Applied rewrites92.2%
if -9.99999999999999992e-300 < (*.f64 #s(literal 2 binary64) a) Initial program 73.9%
lift-cbrt.f64N/A
lift-/.f64N/A
div-invN/A
cbrt-prodN/A
pow1/3N/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
pow-powN/A
lower-pow.f64N/A
metadata-evalN/A
lower-cbrt.f6492.2
Applied rewrites92.2%
Final simplification92.2%
(FPCore (g a) :precision binary64 (/ (cbrt g) (cbrt (* a 2.0))))
double code(double g, double a) {
return cbrt(g) / cbrt((a * 2.0));
}
public static double code(double g, double a) {
return Math.cbrt(g) / Math.cbrt((a * 2.0));
}
function code(g, a) return Float64(cbrt(g) / cbrt(Float64(a * 2.0))) end
code[g_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[N[(a * 2.0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt[3]{g}}{\sqrt[3]{a \cdot 2}}
\end{array}
Initial program 78.2%
lift-cbrt.f64N/A
lift-/.f64N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
lower-cbrt.f6498.7
Applied rewrites98.7%
Final simplification98.7%
(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 78.2%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.8
Applied rewrites98.8%
lift-/.f64N/A
lift-cbrt.f64N/A
lift-cbrt.f64N/A
cbrt-undivN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l/N/A
lift-/.f64N/A
cbrt-prodN/A
pow1/3N/A
pow1/3N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
lift-*.f64N/A
inv-powN/A
pow-powN/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/3N/A
lower-cbrt.f6445.4
Applied rewrites45.4%
lift-pow.f64N/A
metadata-evalN/A
pow-powN/A
inv-powN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
*-inversesN/A
times-fracN/A
lift-*.f64N/A
associate-/l*N/A
*-lft-identityN/A
*-inversesN/A
times-fracN/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
pow1/3N/A
lower-cbrt.f6436.4
Applied rewrites98.7%
Final simplification98.7%
(FPCore (g a)
:precision binary64
(let* ((t_0 (cbrt (* g (* a (* 0.5 a)))))
(t_1 (/ g (* a 2.0)))
(t_2 (/ 1.0 (cbrt (* a (/ 2.0 g))))))
(if (<= t_1 -5e-306)
t_2
(if (<= t_1 1e-290)
(/ t_0 a)
(if (<= t_1 2e+302) t_2 (* t_0 (/ 1.0 a)))))))
double code(double g, double a) {
double t_0 = cbrt((g * (a * (0.5 * a))));
double t_1 = g / (a * 2.0);
double t_2 = 1.0 / cbrt((a * (2.0 / g)));
double tmp;
if (t_1 <= -5e-306) {
tmp = t_2;
} else if (t_1 <= 1e-290) {
tmp = t_0 / a;
} else if (t_1 <= 2e+302) {
tmp = t_2;
} else {
tmp = t_0 * (1.0 / a);
}
return tmp;
}
public static double code(double g, double a) {
double t_0 = Math.cbrt((g * (a * (0.5 * a))));
double t_1 = g / (a * 2.0);
double t_2 = 1.0 / Math.cbrt((a * (2.0 / g)));
double tmp;
if (t_1 <= -5e-306) {
tmp = t_2;
} else if (t_1 <= 1e-290) {
tmp = t_0 / a;
} else if (t_1 <= 2e+302) {
tmp = t_2;
} else {
tmp = t_0 * (1.0 / a);
}
return tmp;
}
function code(g, a) t_0 = cbrt(Float64(g * Float64(a * Float64(0.5 * a)))) t_1 = Float64(g / Float64(a * 2.0)) t_2 = Float64(1.0 / cbrt(Float64(a * Float64(2.0 / g)))) tmp = 0.0 if (t_1 <= -5e-306) tmp = t_2; elseif (t_1 <= 1e-290) tmp = Float64(t_0 / a); elseif (t_1 <= 2e+302) tmp = t_2; else tmp = Float64(t_0 * Float64(1.0 / a)); end return tmp end
code[g_, a_] := Block[{t$95$0 = N[Power[N[(g * N[(a * N[(0.5 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[(g / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[Power[N[(a * N[(2.0 / g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-306], t$95$2, If[LessEqual[t$95$1, 1e-290], N[(t$95$0 / a), $MachinePrecision], If[LessEqual[t$95$1, 2e+302], t$95$2, N[(t$95$0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{g \cdot \left(a \cdot \left(0.5 \cdot a\right)\right)}\\
t_1 := \frac{g}{a \cdot 2}\\
t_2 := \frac{1}{\sqrt[3]{a \cdot \frac{2}{g}}}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-306}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{-290}:\\
\;\;\;\;\frac{t\_0}{a}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{1}{a}\\
\end{array}
\end{array}
if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -4.99999999999999998e-306 or 1.0000000000000001e-290 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 2.0000000000000002e302Initial program 93.1%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.8
Applied rewrites98.8%
Applied rewrites98.8%
Applied rewrites43.3%
Applied rewrites93.9%
if -4.99999999999999998e-306 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 1.0000000000000001e-290Initial program 15.8%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.6
Applied rewrites98.6%
Applied rewrites98.6%
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-cbrt.f64N/A
lift-cbrt.f64N/A
cbrt-undivN/A
lift-neg.f64N/A
neg-mul-1N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
metadata-evalN/A
metadata-evalN/A
*-inversesN/A
associate-/l*N/A
*-commutativeN/A
lift-*.f64N/A
/-rgt-identityN/A
associate-/r/N/A
*-inversesN/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l/N/A
Applied rewrites32.9%
if 2.0000000000000002e302 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) Initial program 4.4%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6499.3
Applied rewrites99.3%
Applied rewrites98.4%
Applied rewrites46.3%
Final simplification83.0%
(FPCore (g a)
:precision binary64
(let* ((t_0 (/ (cbrt (* g (* a (* 0.5 a)))) a))
(t_1 (/ g (* a 2.0)))
(t_2 (/ 1.0 (cbrt (* a (/ 2.0 g))))))
(if (<= t_1 -5e-306)
t_2
(if (<= t_1 1e-290) t_0 (if (<= t_1 2e+302) t_2 t_0)))))
double code(double g, double a) {
double t_0 = cbrt((g * (a * (0.5 * a)))) / a;
double t_1 = g / (a * 2.0);
double t_2 = 1.0 / cbrt((a * (2.0 / g)));
double tmp;
if (t_1 <= -5e-306) {
tmp = t_2;
} else if (t_1 <= 1e-290) {
tmp = t_0;
} else if (t_1 <= 2e+302) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double g, double a) {
double t_0 = Math.cbrt((g * (a * (0.5 * a)))) / a;
double t_1 = g / (a * 2.0);
double t_2 = 1.0 / Math.cbrt((a * (2.0 / g)));
double tmp;
if (t_1 <= -5e-306) {
tmp = t_2;
} else if (t_1 <= 1e-290) {
tmp = t_0;
} else if (t_1 <= 2e+302) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
function code(g, a) t_0 = Float64(cbrt(Float64(g * Float64(a * Float64(0.5 * a)))) / a) t_1 = Float64(g / Float64(a * 2.0)) t_2 = Float64(1.0 / cbrt(Float64(a * Float64(2.0 / g)))) tmp = 0.0 if (t_1 <= -5e-306) tmp = t_2; elseif (t_1 <= 1e-290) tmp = t_0; elseif (t_1 <= 2e+302) tmp = t_2; else tmp = t_0; end return tmp end
code[g_, a_] := Block[{t$95$0 = N[(N[Power[N[(g * N[(a * N[(0.5 * 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[(1.0 / N[Power[N[(a * N[(2.0 / g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-306], t$95$2, If[LessEqual[t$95$1, 1e-290], t$95$0, If[LessEqual[t$95$1, 2e+302], t$95$2, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt[3]{g \cdot \left(a \cdot \left(0.5 \cdot a\right)\right)}}{a}\\
t_1 := \frac{g}{a \cdot 2}\\
t_2 := \frac{1}{\sqrt[3]{a \cdot \frac{2}{g}}}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-306}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{-290}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -4.99999999999999998e-306 or 1.0000000000000001e-290 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 2.0000000000000002e302Initial program 93.1%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.8
Applied rewrites98.8%
Applied rewrites98.8%
Applied rewrites43.3%
Applied rewrites93.9%
if -4.99999999999999998e-306 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 1.0000000000000001e-290 or 2.0000000000000002e302 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) Initial program 13.4%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.8
Applied rewrites98.8%
Applied rewrites98.5%
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-cbrt.f64N/A
lift-cbrt.f64N/A
cbrt-undivN/A
lift-neg.f64N/A
neg-mul-1N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
metadata-evalN/A
metadata-evalN/A
*-inversesN/A
associate-/l*N/A
*-commutativeN/A
lift-*.f64N/A
/-rgt-identityN/A
associate-/r/N/A
*-inversesN/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l/N/A
Applied rewrites35.7%
Final simplification83.0%
(FPCore (g a) :precision binary64 (let* ((t_0 (/ g (* a 2.0)))) (if (<= t_0 2e+302) (cbrt t_0) (/ (cbrt (* g (* a (* 0.5 a)))) a))))
double code(double g, double a) {
double t_0 = g / (a * 2.0);
double tmp;
if (t_0 <= 2e+302) {
tmp = cbrt(t_0);
} else {
tmp = cbrt((g * (a * (0.5 * a)))) / a;
}
return tmp;
}
public static double code(double g, double a) {
double t_0 = g / (a * 2.0);
double tmp;
if (t_0 <= 2e+302) {
tmp = Math.cbrt(t_0);
} else {
tmp = Math.cbrt((g * (a * (0.5 * a)))) / a;
}
return tmp;
}
function code(g, a) t_0 = Float64(g / Float64(a * 2.0)) tmp = 0.0 if (t_0 <= 2e+302) tmp = cbrt(t_0); else tmp = Float64(cbrt(Float64(g * Float64(a * Float64(0.5 * a)))) / a); end return tmp end
code[g_, a_] := Block[{t$95$0 = N[(g / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e+302], N[Power[t$95$0, 1/3], $MachinePrecision], N[(N[Power[N[(g * N[(a * N[(0.5 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{g}{a \cdot 2}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;\sqrt[3]{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{g \cdot \left(a \cdot \left(0.5 \cdot a\right)\right)}}{a}\\
\end{array}
\end{array}
if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 2.0000000000000002e302Initial program 81.2%
if 2.0000000000000002e302 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) Initial program 4.4%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6499.3
Applied rewrites99.3%
Applied rewrites98.4%
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-cbrt.f64N/A
lift-cbrt.f64N/A
cbrt-undivN/A
lift-neg.f64N/A
neg-mul-1N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
metadata-evalN/A
metadata-evalN/A
*-inversesN/A
associate-/l*N/A
*-commutativeN/A
lift-*.f64N/A
/-rgt-identityN/A
associate-/r/N/A
*-inversesN/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l/N/A
Applied rewrites46.2%
Final simplification79.8%
(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 78.2%
Final simplification78.2%
(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 78.2%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval78.1
Applied rewrites78.1%
Final simplification78.1%
herbie shell --seed 2024226
(FPCore (g a)
:name "2-ancestry mixing, zero discriminant"
:precision binary64
(cbrt (/ g (* 2.0 a))))