
(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 6 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 76.0%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
cbrt-divN/A
distribute-neg-fracN/A
cbrt-divN/A
pow1/3N/A
sqr-powN/A
pow-prod-downN/A
sqr-negN/A
remove-double-negN/A
remove-double-negN/A
pow-prod-downN/A
sqr-powN/A
pow1/3N/A
cbrt-divN/A
pow1/3N/A
lower-/.f64N/A
Applied rewrites98.7%
lift-/.f64N/A
lift-cbrt.f64N/A
lift-cbrt.f64N/A
cbrt-undivN/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
cbrt-divN/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-cbrt.f64N/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.7
Applied rewrites98.7%
Final simplification98.7%
(FPCore (g a) :precision binary64 (/ (cbrt g) (cbrt (* 2.0 a))))
double code(double g, double a) {
return cbrt(g) / cbrt((2.0 * a));
}
public static double code(double g, double a) {
return Math.cbrt(g) / Math.cbrt((2.0 * a));
}
function code(g, a) return Float64(cbrt(g) / cbrt(Float64(2.0 * a))) end
code[g_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[N[(2.0 * a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt[3]{g}}{\sqrt[3]{2 \cdot a}}
\end{array}
Initial program 76.0%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
cbrt-divN/A
distribute-neg-fracN/A
cbrt-divN/A
pow1/3N/A
sqr-powN/A
pow-prod-downN/A
sqr-negN/A
remove-double-negN/A
remove-double-negN/A
pow-prod-downN/A
sqr-powN/A
pow1/3N/A
cbrt-divN/A
pow1/3N/A
lower-/.f64N/A
Applied rewrites98.7%
lift-/.f64N/A
lift-cbrt.f64N/A
lift-cbrt.f64N/A
cbrt-undivN/A
clear-numN/A
lift-neg.f64N/A
neg-mul-1N/A
lift-*.f64N/A
times-fracN/A
metadata-evalN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
clear-numN/A
cbrt-undivN/A
lift-/.f64N/A
cbrt-divN/A
lift-cbrt.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-cbrt.f64N/A
lift-cbrt.f64N/A
cbrt-unprodN/A
lower-cbrt.f64N/A
lower-*.f6498.7
Applied rewrites98.7%
(FPCore (g a) :precision binary64 (* (cbrt (/ 0.5 a)) (cbrt g)))
double code(double g, double a) {
return cbrt((0.5 / a)) * cbrt(g);
}
public static double code(double g, double a) {
return Math.cbrt((0.5 / a)) * Math.cbrt(g);
}
function code(g, a) return Float64(cbrt(Float64(0.5 / a)) * cbrt(g)) end
code[g_, a_] := N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{0.5}{a}} \cdot \sqrt[3]{g}
\end{array}
Initial program 76.0%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
cbrt-divN/A
distribute-neg-fracN/A
cbrt-divN/A
pow1/3N/A
sqr-powN/A
pow-prod-downN/A
sqr-negN/A
remove-double-negN/A
remove-double-negN/A
pow-prod-downN/A
sqr-powN/A
pow1/3N/A
cbrt-divN/A
pow1/3N/A
lower-/.f64N/A
Applied rewrites98.7%
lift-/.f64N/A
lift-cbrt.f64N/A
lift-cbrt.f64N/A
cbrt-undivN/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-outN/A
lift-neg.f64N/A
cbrt-divN/A
lift-neg.f64N/A
remove-double-negN/A
cbrt-divN/A
associate-*l/N/A
lift-/.f64N/A
lift-neg.f64N/A
neg-mul-1N/A
associate-*r*N/A
cbrt-prodN/A
Applied rewrites98.7%
(FPCore (g a) :precision binary64 (cbrt (/ g (/ -1.0 (/ -0.5 a)))))
double code(double g, double a) {
return cbrt((g / (-1.0 / (-0.5 / a))));
}
public static double code(double g, double a) {
return Math.cbrt((g / (-1.0 / (-0.5 / a))));
}
function code(g, a) return cbrt(Float64(g / Float64(-1.0 / Float64(-0.5 / a)))) end
code[g_, a_] := N[Power[N[(g / N[(-1.0 / N[(-0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{g}{\frac{-1}{\frac{-0.5}{a}}}}
\end{array}
Initial program 76.0%
remove-double-divN/A
frac-2negN/A
metadata-evalN/A
distribute-frac-neg2N/A
inv-powN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
pow-prod-downN/A
sqr-negN/A
remove-double-negN/A
remove-double-negN/A
pow2N/A
pow-powN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
inv-powN/A
lower-/.f64N/A
Applied rewrites76.1%
(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}
Initial program 76.0%
(FPCore (g a) :precision binary64 (cbrt (* (/ 0.5 a) g)))
double code(double g, double a) {
return cbrt(((0.5 / a) * g));
}
public static double code(double g, double a) {
return Math.cbrt(((0.5 / a) * g));
}
function code(g, a) return cbrt(Float64(Float64(0.5 / a) * g)) end
code[g_, a_] := N[Power[N[(N[(0.5 / a), $MachinePrecision] * g), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{0.5}{a} \cdot g}
\end{array}
Initial program 76.0%
lift-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-2negN/A
cbrt-divN/A
distribute-neg-fracN/A
cbrt-divN/A
pow1/3N/A
sqr-powN/A
pow-prod-downN/A
sqr-negN/A
remove-double-negN/A
remove-double-negN/A
pow-prod-downN/A
sqr-powN/A
pow1/3N/A
cbrt-divN/A
pow1/3N/A
lower-/.f64N/A
Applied rewrites98.7%
lift-/.f64N/A
lift-cbrt.f64N/A
lift-*.f64N/A
metadata-evalN/A
associate-/r/N/A
unpow-1N/A
lift-pow.f64N/A
lift-cbrt.f64N/A
cbrt-divN/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cbrt.f6474.7
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow-1N/A
un-div-invN/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites76.0%
herbie shell --seed 2024276
(FPCore (g a)
:name "2-ancestry mixing, zero discriminant"
:precision binary64
(cbrt (/ g (* 2.0 a))))