
(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]
\sqrt[3]{\frac{g}{2 \cdot a}}
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]
\sqrt[3]{\frac{g}{2 \cdot a}}
(FPCore (g a) :precision binary64 (/ (cbrt (* 0.5 g)) (cbrt a)))
double code(double g, double a) {
return cbrt((0.5 * g)) / cbrt(a);
}
public static double code(double g, double a) {
return Math.cbrt((0.5 * g)) / Math.cbrt(a);
}
function code(g, a) return Float64(cbrt(Float64(0.5 * g)) / cbrt(a)) end
code[g_, a_] := N[(N[Power[N[(0.5 * g), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]
\frac{\sqrt[3]{0.5 \cdot g}}{\sqrt[3]{a}}
Initial program 76.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
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.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]
\sqrt[3]{\frac{0.5}{a}} \cdot \sqrt[3]{g}
Initial program 76.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
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.7%
Applied rewrites98.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6498.7%
Applied rewrites98.7%
lift-cbrt.f64N/A
lift-/.f64N/A
cbrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-cbrt.f6498.7%
Applied rewrites98.7%
Applied rewrites98.7%
(FPCore (g a) :precision binary64 (/ (cbrt g) (cbrt (+ a a))))
double code(double g, double a) {
return cbrt(g) / cbrt((a + a));
}
public static double code(double g, double a) {
return Math.cbrt(g) / Math.cbrt((a + a));
}
function code(g, a) return Float64(cbrt(g) / cbrt(Float64(a + a))) end
code[g_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[N[(a + a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\frac{\sqrt[3]{g}}{\sqrt[3]{a + a}}
Initial program 76.3%
lift-cbrt.f64N/A
lift-/.f64N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.f64N/A
lower-cbrt.f6498.6%
lift-*.f64N/A
count-2-revN/A
lower-+.f6498.6%
Applied rewrites98.6%
(FPCore (g a) :precision binary64 (/ -1.0 (cbrt (* (/ -2.0 g) a))))
double code(double g, double a) {
return -1.0 / cbrt(((-2.0 / g) * a));
}
public static double code(double g, double a) {
return -1.0 / Math.cbrt(((-2.0 / g) * a));
}
function code(g, a) return Float64(-1.0 / cbrt(Float64(Float64(-2.0 / g) * a))) end
code[g_, a_] := N[(-1.0 / N[Power[N[(N[(-2.0 / g), $MachinePrecision] * a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\frac{-1}{\sqrt[3]{\frac{-2}{g} \cdot a}}
Initial program 76.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
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.7%
Applied rewrites98.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6498.7%
Applied rewrites98.7%
lift-/.f64N/A
mult-flipN/A
lift-cbrt.f64N/A
lift-/.f64N/A
cbrt-divN/A
metadata-evalN/A
frac-2negN/A
metadata-evalN/A
associate-*l/N/A
mul-1-negN/A
mul-1-negN/A
*-commutativeN/A
associate-*r/N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
lower-/.f64N/A
lift-cbrt.f64N/A
cbrt-neg-revN/A
cbrt-unprodN/A
*-commutativeN/A
Applied rewrites76.2%
(FPCore (g a) :precision binary64 (/ 1.0 (cbrt (/ (+ a a) g))))
double code(double g, double a) {
return 1.0 / cbrt(((a + a) / g));
}
public static double code(double g, double a) {
return 1.0 / Math.cbrt(((a + a) / g));
}
function code(g, a) return Float64(1.0 / cbrt(Float64(Float64(a + a) / g))) end
code[g_, a_] := N[(1.0 / N[Power[N[(N[(a + a), $MachinePrecision] / g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\frac{1}{\sqrt[3]{\frac{a + a}{g}}}
Initial program 76.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
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-cbrt.f6498.7%
Applied rewrites98.7%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6498.7%
Applied rewrites98.7%
lift-/.f64N/A
mult-flipN/A
lift-cbrt.f64N/A
lift-/.f64N/A
cbrt-divN/A
metadata-evalN/A
inv-powN/A
inv-powN/A
pow-prod-downN/A
inv-powN/A
lower-/.f64N/A
lift-cbrt.f64N/A
cbrt-unprodN/A
lower-cbrt.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
count-2-revN/A
lower-+.f6476.1%
Applied rewrites76.1%
(FPCore (g a) :precision binary64 (/ (cbrt (/ g a)) 1.2599210498948732))
double code(double g, double a) {
return cbrt((g / a)) / 1.2599210498948732;
}
public static double code(double g, double a) {
return Math.cbrt((g / a)) / 1.2599210498948732;
}
function code(g, a) return Float64(cbrt(Float64(g / a)) / 1.2599210498948732) end
code[g_, a_] := N[(N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision] / 1.2599210498948732), $MachinePrecision]
\frac{\sqrt[3]{\frac{g}{a}}}{1.2599210498948732}
Initial program 76.3%
lift-cbrt.f64N/A
lift-/.f64N/A
cbrt-divN/A
lift-*.f64N/A
*-commutativeN/A
cbrt-prodN/A
associate-/r*N/A
lower-/.f64N/A
cbrt-undivN/A
lower-cbrt.f64N/A
lower-/.f64N/A
lower-cbrt.f6475.7%
Applied rewrites75.7%
Evaluated real constant76.3%
(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]
\sqrt[3]{\frac{0.5}{a} \cdot g}
Initial program 76.3%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval76.4%
Applied rewrites76.4%
(FPCore (g a) :precision binary64 (cbrt (/ g (+ a a))))
double code(double g, double a) {
return cbrt((g / (a + a)));
}
public static double code(double g, double a) {
return Math.cbrt((g / (a + a)));
}
function code(g, a) return cbrt(Float64(g / Float64(a + a))) end
code[g_, a_] := N[Power[N[(g / N[(a + a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\sqrt[3]{\frac{g}{a + a}}
Initial program 76.3%
lift-*.f64N/A
count-2-revN/A
lower-+.f6476.3%
Applied rewrites76.3%
herbie shell --seed 2025205
(FPCore (g a)
:name "2-ancestry mixing, zero discriminant"
:precision binary64
(cbrt (/ g (* 2.0 a))))