
(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 7 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 (/ -1.0 a))))
double code(double g, double a) {
return cbrt((-0.5 * g)) * cbrt((-1.0 / a));
}
public static double code(double g, double a) {
return Math.cbrt((-0.5 * g)) * Math.cbrt((-1.0 / a));
}
function code(g, a) return Float64(cbrt(Float64(-0.5 * g)) * cbrt(Float64(-1.0 / a))) end
code[g_, a_] := N[(N[Power[N[(-0.5 * g), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(-1.0 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\sqrt[3]{-0.5 \cdot g} \cdot \sqrt[3]{\frac{-1}{a}}
Initial program 76.3%
lift-cbrt.64N/A
lift-/.f64N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.64N/A
lower-cbrt.6498.6%
lift-*.f64N/A
count-2-revN/A
lower-+.f6498.6%
Applied rewrites98.6%
lift-/.f64N/A
lift-cbrt.64N/A
lift-cbrt.64N/A
cbrt-undivN/A
pow1/3N/A
mult-flipN/A
lift-+.f64N/A
count-2N/A
associate-/r*N/A
metadata-evalN/A
frac-2negN/A
mult-flipN/A
associate-*r*N/A
unpow-prod-downN/A
lower-unsound-pow.64N/A
lower-pow.64N/A
pow1/3N/A
lower-unsound-*.f64N/A
lower-cbrt.64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-pow.64N/A
lower-pow.64N/A
pow1/3N/A
lower-cbrt.64N/A
frac-2negN/A
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.64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
cbrt-prodN/A
lower-*.f64N/A
lower-cbrt.64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
metadata-evalN/A
lower-cbrt.6498.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.64N/A
lift-/.f64N/A
cbrt-divN/A
lower-/.f64N/A
lower-cbrt.64N/A
lower-cbrt.6498.6%
lift-*.f64N/A
count-2-revN/A
lower-+.f6498.6%
Applied rewrites98.6%
(FPCore (g a)
:precision binary64
(let* ((t_0 (fabs (fabs a))) (t_1 (cbrt (/ (fabs g) (* 2.0 (fabs a))))))
(*
(copysign 1.0 g)
(*
(copysign 1.0 a)
(if (<= t_1 1e-103)
(exp (* (- (log (* (fabs g) 0.5)) (log (fabs a))) 0.3333333333333333))
(if (<= t_1 5e+102)
(cbrt (/ 1.0 (/ t_0 (* (* 0.5 (fabs a)) (/ (fabs g) t_0)))))
(exp
(*
(- (log (fabs g)) (log (+ (fabs a) (fabs a))))
0.3333333333333333))))))))double code(double g, double a) {
double t_0 = fabs(fabs(a));
double t_1 = cbrt((fabs(g) / (2.0 * fabs(a))));
double tmp;
if (t_1 <= 1e-103) {
tmp = exp(((log((fabs(g) * 0.5)) - log(fabs(a))) * 0.3333333333333333));
} else if (t_1 <= 5e+102) {
tmp = cbrt((1.0 / (t_0 / ((0.5 * fabs(a)) * (fabs(g) / t_0)))));
} else {
tmp = exp(((log(fabs(g)) - log((fabs(a) + fabs(a)))) * 0.3333333333333333));
}
return copysign(1.0, g) * (copysign(1.0, a) * tmp);
}
public static double code(double g, double a) {
double t_0 = Math.abs(Math.abs(a));
double t_1 = Math.cbrt((Math.abs(g) / (2.0 * Math.abs(a))));
double tmp;
if (t_1 <= 1e-103) {
tmp = Math.exp(((Math.log((Math.abs(g) * 0.5)) - Math.log(Math.abs(a))) * 0.3333333333333333));
} else if (t_1 <= 5e+102) {
tmp = Math.cbrt((1.0 / (t_0 / ((0.5 * Math.abs(a)) * (Math.abs(g) / t_0)))));
} else {
tmp = Math.exp(((Math.log(Math.abs(g)) - Math.log((Math.abs(a) + Math.abs(a)))) * 0.3333333333333333));
}
return Math.copySign(1.0, g) * (Math.copySign(1.0, a) * tmp);
}
function code(g, a) t_0 = abs(abs(a)) t_1 = cbrt(Float64(abs(g) / Float64(2.0 * abs(a)))) tmp = 0.0 if (t_1 <= 1e-103) tmp = exp(Float64(Float64(log(Float64(abs(g) * 0.5)) - log(abs(a))) * 0.3333333333333333)); elseif (t_1 <= 5e+102) tmp = cbrt(Float64(1.0 / Float64(t_0 / Float64(Float64(0.5 * abs(a)) * Float64(abs(g) / t_0))))); else tmp = exp(Float64(Float64(log(abs(g)) - log(Float64(abs(a) + abs(a)))) * 0.3333333333333333)); end return Float64(copysign(1.0, g) * Float64(copysign(1.0, a) * tmp)) end
code[g_, a_] := Block[{t$95$0 = N[Abs[N[Abs[a], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[Abs[g], $MachinePrecision] / N[(2.0 * N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[g]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$1, 1e-103], N[Exp[N[(N[(N[Log[N[(N[Abs[g], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] - N[Log[N[Abs[a], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 5e+102], N[Power[N[(1.0 / N[(t$95$0 / N[(N[(0.5 * N[Abs[a], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[g], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], N[Exp[N[(N[(N[Log[N[Abs[g], $MachinePrecision]], $MachinePrecision] - N[Log[N[(N[Abs[a], $MachinePrecision] + N[Abs[a], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|\left|a\right|\right|\\
t_1 := \sqrt[3]{\frac{\left|g\right|}{2 \cdot \left|a\right|}}\\
\mathsf{copysign}\left(1, g\right) \cdot \left(\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 10^{-103}:\\
\;\;\;\;e^{\left(\log \left(\left|g\right| \cdot 0.5\right) - \log \left(\left|a\right|\right)\right) \cdot 0.3333333333333333}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+102}:\\
\;\;\;\;\sqrt[3]{\frac{1}{\frac{t\_0}{\left(0.5 \cdot \left|a\right|\right) \cdot \frac{\left|g\right|}{t\_0}}}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\log \left(\left|g\right|\right) - \log \left(\left|a\right| + \left|a\right|\right)\right) \cdot 0.3333333333333333}\\
\end{array}\right)
\end{array}
if (cbrt.64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) < 9.99999999999999958e-104Initial program 76.3%
lift-cbrt.64N/A
pow1/3N/A
pow-to-expN/A
lower-unsound-exp.64N/A
lower-unsound-*.f64N/A
lower-unsound-log.6435.7%
lift-*.f64N/A
count-2-revN/A
lower-+.f6435.7%
Applied rewrites35.7%
lift-log.64N/A
lift-/.f64N/A
lift-+.f64N/A
count-2N/A
associate-/r*N/A
log-divN/A
mult-flip-revN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-log.64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-log.6423.0%
Applied rewrites23.0%
if 9.99999999999999958e-104 < (cbrt.64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) < 5e102Initial program 76.3%
lift-*.f64N/A
count-2-revN/A
lower-+.f6476.3%
Applied rewrites76.3%
lift-/.f64N/A
*-rgt-identityN/A
lift-+.f64N/A
count-2N/A
*-commutativeN/A
frac-timesN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
associate-*l*N/A
*-commutativeN/A
count-2-revN/A
lift-/.f64N/A
lift-/.f64N/A
common-denominatorN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-*.f6439.9%
Applied rewrites39.9%
lift-/.f64N/A
lift-*.f64N/A
sqr-abs-revN/A
associate-/r*N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-fabs.64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
count-2N/A
associate-*r*N/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.6475.5%
Applied rewrites75.5%
if 5e102 < (cbrt.64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) Initial program 76.3%
lift-cbrt.64N/A
pow1/3N/A
pow-to-expN/A
lower-unsound-exp.64N/A
lower-unsound-*.f64N/A
lower-unsound-log.6435.7%
lift-*.f64N/A
count-2-revN/A
lower-+.f6435.7%
Applied rewrites35.7%
lift-log.64N/A
lift-/.f64N/A
log-divN/A
lower-unsound--.f64N/A
lower-unsound-log.64N/A
lower-unsound-log.6423.0%
Applied rewrites23.0%
(FPCore (g a)
:precision binary64
(let* ((t_0 (+ (fabs a) (fabs a))) (t_1 (cbrt (/ (fabs g) (* 2.0 (fabs a))))))
(*
(copysign 1.0 g)
(*
(copysign 1.0 a)
(if (<= t_1 1e-103)
(exp (* (- (log (* (fabs g) 0.5)) (log (fabs a))) 0.3333333333333333))
(if (<= t_1 5e+102)
(cbrt (/ 1.0 (/ t_0 (fabs g))))
(exp (* (- (log (fabs g)) (log t_0)) 0.3333333333333333))))))))double code(double g, double a) {
double t_0 = fabs(a) + fabs(a);
double t_1 = cbrt((fabs(g) / (2.0 * fabs(a))));
double tmp;
if (t_1 <= 1e-103) {
tmp = exp(((log((fabs(g) * 0.5)) - log(fabs(a))) * 0.3333333333333333));
} else if (t_1 <= 5e+102) {
tmp = cbrt((1.0 / (t_0 / fabs(g))));
} else {
tmp = exp(((log(fabs(g)) - log(t_0)) * 0.3333333333333333));
}
return copysign(1.0, g) * (copysign(1.0, a) * tmp);
}
public static double code(double g, double a) {
double t_0 = Math.abs(a) + Math.abs(a);
double t_1 = Math.cbrt((Math.abs(g) / (2.0 * Math.abs(a))));
double tmp;
if (t_1 <= 1e-103) {
tmp = Math.exp(((Math.log((Math.abs(g) * 0.5)) - Math.log(Math.abs(a))) * 0.3333333333333333));
} else if (t_1 <= 5e+102) {
tmp = Math.cbrt((1.0 / (t_0 / Math.abs(g))));
} else {
tmp = Math.exp(((Math.log(Math.abs(g)) - Math.log(t_0)) * 0.3333333333333333));
}
return Math.copySign(1.0, g) * (Math.copySign(1.0, a) * tmp);
}
function code(g, a) t_0 = Float64(abs(a) + abs(a)) t_1 = cbrt(Float64(abs(g) / Float64(2.0 * abs(a)))) tmp = 0.0 if (t_1 <= 1e-103) tmp = exp(Float64(Float64(log(Float64(abs(g) * 0.5)) - log(abs(a))) * 0.3333333333333333)); elseif (t_1 <= 5e+102) tmp = cbrt(Float64(1.0 / Float64(t_0 / abs(g)))); else tmp = exp(Float64(Float64(log(abs(g)) - log(t_0)) * 0.3333333333333333)); end return Float64(copysign(1.0, g) * Float64(copysign(1.0, a) * tmp)) end
code[g_, a_] := Block[{t$95$0 = N[(N[Abs[a], $MachinePrecision] + N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[Abs[g], $MachinePrecision] / N[(2.0 * N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[g]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$1, 1e-103], N[Exp[N[(N[(N[Log[N[(N[Abs[g], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] - N[Log[N[Abs[a], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 5e+102], N[Power[N[(1.0 / N[(t$95$0 / N[Abs[g], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], N[Exp[N[(N[(N[Log[N[Abs[g], $MachinePrecision]], $MachinePrecision] - N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|a\right| + \left|a\right|\\
t_1 := \sqrt[3]{\frac{\left|g\right|}{2 \cdot \left|a\right|}}\\
\mathsf{copysign}\left(1, g\right) \cdot \left(\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 10^{-103}:\\
\;\;\;\;e^{\left(\log \left(\left|g\right| \cdot 0.5\right) - \log \left(\left|a\right|\right)\right) \cdot 0.3333333333333333}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+102}:\\
\;\;\;\;\sqrt[3]{\frac{1}{\frac{t\_0}{\left|g\right|}}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\log \left(\left|g\right|\right) - \log t\_0\right) \cdot 0.3333333333333333}\\
\end{array}\right)
\end{array}
if (cbrt.64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) < 9.99999999999999958e-104Initial program 76.3%
lift-cbrt.64N/A
pow1/3N/A
pow-to-expN/A
lower-unsound-exp.64N/A
lower-unsound-*.f64N/A
lower-unsound-log.6435.7%
lift-*.f64N/A
count-2-revN/A
lower-+.f6435.7%
Applied rewrites35.7%
lift-log.64N/A
lift-/.f64N/A
lift-+.f64N/A
count-2N/A
associate-/r*N/A
log-divN/A
mult-flip-revN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-log.64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-log.6423.0%
Applied rewrites23.0%
if 9.99999999999999958e-104 < (cbrt.64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) < 5e102Initial program 76.3%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6475.5%
lift-*.f64N/A
count-2-revN/A
lower-+.f6475.5%
Applied rewrites75.5%
if 5e102 < (cbrt.64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) Initial program 76.3%
lift-cbrt.64N/A
pow1/3N/A
pow-to-expN/A
lower-unsound-exp.64N/A
lower-unsound-*.f64N/A
lower-unsound-log.6435.7%
lift-*.f64N/A
count-2-revN/A
lower-+.f6435.7%
Applied rewrites35.7%
lift-log.64N/A
lift-/.f64N/A
log-divN/A
lower-unsound--.f64N/A
lower-unsound-log.64N/A
lower-unsound-log.6423.0%
Applied rewrites23.0%
(FPCore (g a)
:precision binary64
(let* ((t_0 (+ (fabs a) (fabs a)))
(t_1 (exp (* (- (log (fabs g)) (log t_0)) 0.3333333333333333)))
(t_2 (cbrt (/ (fabs g) (* 2.0 (fabs a))))))
(*
(copysign 1.0 g)
(*
(copysign 1.0 a)
(if (<= t_2 1e-103)
t_1
(if (<= t_2 5e+102) (cbrt (/ 1.0 (/ t_0 (fabs g)))) t_1))))))double code(double g, double a) {
double t_0 = fabs(a) + fabs(a);
double t_1 = exp(((log(fabs(g)) - log(t_0)) * 0.3333333333333333));
double t_2 = cbrt((fabs(g) / (2.0 * fabs(a))));
double tmp;
if (t_2 <= 1e-103) {
tmp = t_1;
} else if (t_2 <= 5e+102) {
tmp = cbrt((1.0 / (t_0 / fabs(g))));
} else {
tmp = t_1;
}
return copysign(1.0, g) * (copysign(1.0, a) * tmp);
}
public static double code(double g, double a) {
double t_0 = Math.abs(a) + Math.abs(a);
double t_1 = Math.exp(((Math.log(Math.abs(g)) - Math.log(t_0)) * 0.3333333333333333));
double t_2 = Math.cbrt((Math.abs(g) / (2.0 * Math.abs(a))));
double tmp;
if (t_2 <= 1e-103) {
tmp = t_1;
} else if (t_2 <= 5e+102) {
tmp = Math.cbrt((1.0 / (t_0 / Math.abs(g))));
} else {
tmp = t_1;
}
return Math.copySign(1.0, g) * (Math.copySign(1.0, a) * tmp);
}
function code(g, a) t_0 = Float64(abs(a) + abs(a)) t_1 = exp(Float64(Float64(log(abs(g)) - log(t_0)) * 0.3333333333333333)) t_2 = cbrt(Float64(abs(g) / Float64(2.0 * abs(a)))) tmp = 0.0 if (t_2 <= 1e-103) tmp = t_1; elseif (t_2 <= 5e+102) tmp = cbrt(Float64(1.0 / Float64(t_0 / abs(g)))); else tmp = t_1; end return Float64(copysign(1.0, g) * Float64(copysign(1.0, a) * tmp)) end
code[g_, a_] := Block[{t$95$0 = N[(N[Abs[a], $MachinePrecision] + N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(N[Log[N[Abs[g], $MachinePrecision]], $MachinePrecision] - N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(N[Abs[g], $MachinePrecision] / N[(2.0 * N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[g]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$2, 1e-103], t$95$1, If[LessEqual[t$95$2, 5e+102], N[Power[N[(1.0 / N[(t$95$0 / N[Abs[g], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], t$95$1]]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left|a\right| + \left|a\right|\\
t_1 := e^{\left(\log \left(\left|g\right|\right) - \log t\_0\right) \cdot 0.3333333333333333}\\
t_2 := \sqrt[3]{\frac{\left|g\right|}{2 \cdot \left|a\right|}}\\
\mathsf{copysign}\left(1, g\right) \cdot \left(\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq 10^{-103}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+102}:\\
\;\;\;\;\sqrt[3]{\frac{1}{\frac{t\_0}{\left|g\right|}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}\right)
\end{array}
if (cbrt.64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) < 9.99999999999999958e-104 or 5e102 < (cbrt.64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) Initial program 76.3%
lift-cbrt.64N/A
pow1/3N/A
pow-to-expN/A
lower-unsound-exp.64N/A
lower-unsound-*.f64N/A
lower-unsound-log.6435.7%
lift-*.f64N/A
count-2-revN/A
lower-+.f6435.7%
Applied rewrites35.7%
lift-log.64N/A
lift-/.f64N/A
log-divN/A
lower-unsound--.f64N/A
lower-unsound-log.64N/A
lower-unsound-log.6423.0%
Applied rewrites23.0%
if 9.99999999999999958e-104 < (cbrt.64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) < 5e102Initial program 76.3%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6475.5%
lift-*.f64N/A
count-2-revN/A
lower-+.f6475.5%
Applied rewrites75.5%
(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 2025183
(FPCore (g a)
:name "2-ancestry mixing, zero discriminant"
:precision binary64
(cbrt (/ g (* 2.0 a))))