
(FPCore (g h a) :precision binary64 (let* ((t_0 (/ 1.0 (* 2.0 a))) (t_1 (sqrt (- (* g g) (* h h))))) (+ (cbrt (* t_0 (+ (- g) t_1))) (cbrt (* t_0 (- (- g) t_1))))))
double code(double g, double h, double a) {
double t_0 = 1.0 / (2.0 * a);
double t_1 = sqrt(((g * g) - (h * h)));
return cbrt((t_0 * (-g + t_1))) + cbrt((t_0 * (-g - t_1)));
}
public static double code(double g, double h, double a) {
double t_0 = 1.0 / (2.0 * a);
double t_1 = Math.sqrt(((g * g) - (h * h)));
return Math.cbrt((t_0 * (-g + t_1))) + Math.cbrt((t_0 * (-g - t_1)));
}
function code(g, h, a) t_0 = Float64(1.0 / Float64(2.0 * a)) t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h))) return Float64(cbrt(Float64(t_0 * Float64(Float64(-g) + t_1))) + cbrt(Float64(t_0 * Float64(Float64(-g) - t_1)))) end
code[g_, h_, a_] := Block[{t$95$0 = N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(t$95$0 * N[((-g) + t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(t$95$0 * N[((-g) - t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{2 \cdot a}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
\sqrt[3]{t\_0 \cdot \left(\left(-g\right) + t\_1\right)} + \sqrt[3]{t\_0 \cdot \left(\left(-g\right) - t\_1\right)}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (g h a) :precision binary64 (let* ((t_0 (/ 1.0 (* 2.0 a))) (t_1 (sqrt (- (* g g) (* h h))))) (+ (cbrt (* t_0 (+ (- g) t_1))) (cbrt (* t_0 (- (- g) t_1))))))
double code(double g, double h, double a) {
double t_0 = 1.0 / (2.0 * a);
double t_1 = sqrt(((g * g) - (h * h)));
return cbrt((t_0 * (-g + t_1))) + cbrt((t_0 * (-g - t_1)));
}
public static double code(double g, double h, double a) {
double t_0 = 1.0 / (2.0 * a);
double t_1 = Math.sqrt(((g * g) - (h * h)));
return Math.cbrt((t_0 * (-g + t_1))) + Math.cbrt((t_0 * (-g - t_1)));
}
function code(g, h, a) t_0 = Float64(1.0 / Float64(2.0 * a)) t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h))) return Float64(cbrt(Float64(t_0 * Float64(Float64(-g) + t_1))) + cbrt(Float64(t_0 * Float64(Float64(-g) - t_1)))) end
code[g_, h_, a_] := Block[{t$95$0 = N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(t$95$0 * N[((-g) + t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(t$95$0 * N[((-g) - t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{2 \cdot a}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
\sqrt[3]{t\_0 \cdot \left(\left(-g\right) + t\_1\right)} + \sqrt[3]{t\_0 \cdot \left(\left(-g\right) - t\_1\right)}
\end{array}
\end{array}
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (/ h g) h)) (t_1 (sqrt (sqrt (* (- g h) (+ h g))))))
(if (<= g -1.02e+136)
(+ (cbrt (* (* (/ h a) (/ h g)) -0.25)) (cbrt (/ (- g) a)))
(if (<= g -6e-124)
(+
(cbrt (* (/ -1.0 (* a 2.0)) (+ (sqrt (- (* g g) (* h h))) g)))
(* (cbrt (* 0.5 (- (* t_1 t_1) g))) (cbrt (pow a -1.0))))
(+
(cbrt (/ (- (* 0.25 t_0) g) a))
(cbrt (* (/ 0.5 a) (* -0.5 t_0))))))))
double code(double g, double h, double a) {
double t_0 = (h / g) * h;
double t_1 = sqrt(sqrt(((g - h) * (h + g))));
double tmp;
if (g <= -1.02e+136) {
tmp = cbrt((((h / a) * (h / g)) * -0.25)) + cbrt((-g / a));
} else if (g <= -6e-124) {
tmp = cbrt(((-1.0 / (a * 2.0)) * (sqrt(((g * g) - (h * h))) + g))) + (cbrt((0.5 * ((t_1 * t_1) - g))) * cbrt(pow(a, -1.0)));
} else {
tmp = cbrt((((0.25 * t_0) - g) / a)) + cbrt(((0.5 / a) * (-0.5 * t_0)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = (h / g) * h;
double t_1 = Math.sqrt(Math.sqrt(((g - h) * (h + g))));
double tmp;
if (g <= -1.02e+136) {
tmp = Math.cbrt((((h / a) * (h / g)) * -0.25)) + Math.cbrt((-g / a));
} else if (g <= -6e-124) {
tmp = Math.cbrt(((-1.0 / (a * 2.0)) * (Math.sqrt(((g * g) - (h * h))) + g))) + (Math.cbrt((0.5 * ((t_1 * t_1) - g))) * Math.cbrt(Math.pow(a, -1.0)));
} else {
tmp = Math.cbrt((((0.25 * t_0) - g) / a)) + Math.cbrt(((0.5 / a) * (-0.5 * t_0)));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(Float64(h / g) * h) t_1 = sqrt(sqrt(Float64(Float64(g - h) * Float64(h + g)))) tmp = 0.0 if (g <= -1.02e+136) tmp = Float64(cbrt(Float64(Float64(Float64(h / a) * Float64(h / g)) * -0.25)) + cbrt(Float64(Float64(-g) / a))); elseif (g <= -6e-124) tmp = Float64(cbrt(Float64(Float64(-1.0 / Float64(a * 2.0)) * Float64(sqrt(Float64(Float64(g * g) - Float64(h * h))) + g))) + Float64(cbrt(Float64(0.5 * Float64(Float64(t_1 * t_1) - g))) * cbrt((a ^ -1.0)))); else tmp = Float64(cbrt(Float64(Float64(Float64(0.25 * t_0) - g) / a)) + cbrt(Float64(Float64(0.5 / a) * Float64(-0.5 * t_0)))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[(h / g), $MachinePrecision] * h), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[Sqrt[N[(N[(g - h), $MachinePrecision] * N[(h + g), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[g, -1.02e+136], N[(N[Power[N[(N[(N[(h / a), $MachinePrecision] * N[(h / g), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, -6e-124], N[(N[Power[N[(N[(-1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[N[(0.5 * N[(N[(t$95$1 * t$95$1), $MachinePrecision] - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[Power[a, -1.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(N[(0.25 * t$95$0), $MachinePrecision] - g), $MachinePrecision] / a), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{h}{g} \cdot h\\
t_1 := \sqrt{\sqrt{\left(g - h\right) \cdot \left(h + g\right)}}\\
\mathbf{if}\;g \leq -1.02 \cdot 10^{+136}:\\
\;\;\;\;\sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\
\mathbf{elif}\;g \leq -6 \cdot 10^{-124}:\\
\;\;\;\;\sqrt[3]{\frac{-1}{a \cdot 2} \cdot \left(\sqrt{g \cdot g - h \cdot h} + g\right)} + \sqrt[3]{0.5 \cdot \left(t\_1 \cdot t\_1 - g\right)} \cdot \sqrt[3]{{a}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{0.25 \cdot t\_0 - g}{a}} + \sqrt[3]{\frac{0.5}{a} \cdot \left(-0.5 \cdot t\_0\right)}\\
\end{array}
\end{array}
if g < -1.01999999999999996e136Initial program 7.1%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f644.5
Applied rewrites4.5%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6464.1
Applied rewrites64.1%
Taylor expanded in g around inf
lower-*.f64N/A
lower-cbrt.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cbrt.f64N/A
lower-cbrt.f6465.5
Applied rewrites65.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6465.5
Applied rewrites65.5%
if -1.01999999999999996e136 < g < -6e-124Initial program 74.5%
lift-cbrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
cbrt-prodN/A
lower-*.f64N/A
lower-cbrt.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-cbrt.f64N/A
div-invN/A
metadata-evalN/A
Applied rewrites97.9%
lift-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
difference-of-squaresN/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
Applied rewrites98.0%
if -6e-124 < g Initial program 46.6%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6443.4
Applied rewrites43.4%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6477.4
Applied rewrites77.4%
Taylor expanded in h around 0
+-commutativeN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6477.5
Applied rewrites77.5%
Applied rewrites81.0%
Final simplification80.8%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (/ h g) h)))
(if (<= g -4.6e+145)
(+ (cbrt (* (* (/ h a) (/ h g)) -0.25)) (cbrt (/ (- g) a)))
(if (<= g -6e-124)
(+
(/ (cbrt (- (sqrt (* (- g h) (+ h g))) g)) (cbrt (* a 2.0)))
(cbrt (* (/ -1.0 (* a 2.0)) (+ (sqrt (- (* g g) (* h h))) g))))
(+
(cbrt (/ (- (* 0.25 t_0) g) a))
(cbrt (* (/ 0.5 a) (* -0.5 t_0))))))))
double code(double g, double h, double a) {
double t_0 = (h / g) * h;
double tmp;
if (g <= -4.6e+145) {
tmp = cbrt((((h / a) * (h / g)) * -0.25)) + cbrt((-g / a));
} else if (g <= -6e-124) {
tmp = (cbrt((sqrt(((g - h) * (h + g))) - g)) / cbrt((a * 2.0))) + cbrt(((-1.0 / (a * 2.0)) * (sqrt(((g * g) - (h * h))) + g)));
} else {
tmp = cbrt((((0.25 * t_0) - g) / a)) + cbrt(((0.5 / a) * (-0.5 * t_0)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = (h / g) * h;
double tmp;
if (g <= -4.6e+145) {
tmp = Math.cbrt((((h / a) * (h / g)) * -0.25)) + Math.cbrt((-g / a));
} else if (g <= -6e-124) {
tmp = (Math.cbrt((Math.sqrt(((g - h) * (h + g))) - g)) / Math.cbrt((a * 2.0))) + Math.cbrt(((-1.0 / (a * 2.0)) * (Math.sqrt(((g * g) - (h * h))) + g)));
} else {
tmp = Math.cbrt((((0.25 * t_0) - g) / a)) + Math.cbrt(((0.5 / a) * (-0.5 * t_0)));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(Float64(h / g) * h) tmp = 0.0 if (g <= -4.6e+145) tmp = Float64(cbrt(Float64(Float64(Float64(h / a) * Float64(h / g)) * -0.25)) + cbrt(Float64(Float64(-g) / a))); elseif (g <= -6e-124) tmp = Float64(Float64(cbrt(Float64(sqrt(Float64(Float64(g - h) * Float64(h + g))) - g)) / cbrt(Float64(a * 2.0))) + cbrt(Float64(Float64(-1.0 / Float64(a * 2.0)) * Float64(sqrt(Float64(Float64(g * g) - Float64(h * h))) + g)))); else tmp = Float64(cbrt(Float64(Float64(Float64(0.25 * t_0) - g) / a)) + cbrt(Float64(Float64(0.5 / a) * Float64(-0.5 * t_0)))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[(h / g), $MachinePrecision] * h), $MachinePrecision]}, If[LessEqual[g, -4.6e+145], N[(N[Power[N[(N[(N[(h / a), $MachinePrecision] * N[(h / g), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, -6e-124], N[(N[(N[Power[N[(N[Sqrt[N[(N[(g - h), $MachinePrecision] * N[(h + g), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - g), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[N[(a * 2.0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(-1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(N[(0.25 * t$95$0), $MachinePrecision] - g), $MachinePrecision] / a), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{h}{g} \cdot h\\
\mathbf{if}\;g \leq -4.6 \cdot 10^{+145}:\\
\;\;\;\;\sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\
\mathbf{elif}\;g \leq -6 \cdot 10^{-124}:\\
\;\;\;\;\frac{\sqrt[3]{\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g}}{\sqrt[3]{a \cdot 2}} + \sqrt[3]{\frac{-1}{a \cdot 2} \cdot \left(\sqrt{g \cdot g - h \cdot h} + g\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{0.25 \cdot t\_0 - g}{a}} + \sqrt[3]{\frac{0.5}{a} \cdot \left(-0.5 \cdot t\_0\right)}\\
\end{array}
\end{array}
if g < -4.6e145Initial program 4.4%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f644.1
Applied rewrites4.1%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in g around inf
lower-*.f64N/A
lower-cbrt.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cbrt.f64N/A
lower-cbrt.f6464.5
Applied rewrites64.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6464.5
Applied rewrites64.5%
if -4.6e145 < g < -6e-124Initial program 75.3%
lift-cbrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
cbrt-divN/A
*-lft-identityN/A
pow1/3N/A
lower-/.f64N/A
Applied rewrites98.0%
if -6e-124 < g Initial program 46.6%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6443.4
Applied rewrites43.4%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6477.4
Applied rewrites77.4%
Taylor expanded in h around 0
+-commutativeN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6477.5
Applied rewrites77.5%
Applied rewrites81.0%
Final simplification80.7%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (/ h g) h)))
(if (<= g -2.5e+150)
(+ (cbrt (* (* (/ h a) (/ h g)) -0.25)) (cbrt (/ (- g) a)))
(if (<= g -6e-124)
(+
(/ (cbrt (* (- (sqrt (* (- g h) (+ h g))) g) 0.5)) (cbrt a))
(cbrt (* (/ -1.0 (* a 2.0)) (+ (sqrt (- (* g g) (* h h))) g))))
(+
(cbrt (/ (- (* 0.25 t_0) g) a))
(cbrt (* (/ 0.5 a) (* -0.5 t_0))))))))
double code(double g, double h, double a) {
double t_0 = (h / g) * h;
double tmp;
if (g <= -2.5e+150) {
tmp = cbrt((((h / a) * (h / g)) * -0.25)) + cbrt((-g / a));
} else if (g <= -6e-124) {
tmp = (cbrt(((sqrt(((g - h) * (h + g))) - g) * 0.5)) / cbrt(a)) + cbrt(((-1.0 / (a * 2.0)) * (sqrt(((g * g) - (h * h))) + g)));
} else {
tmp = cbrt((((0.25 * t_0) - g) / a)) + cbrt(((0.5 / a) * (-0.5 * t_0)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = (h / g) * h;
double tmp;
if (g <= -2.5e+150) {
tmp = Math.cbrt((((h / a) * (h / g)) * -0.25)) + Math.cbrt((-g / a));
} else if (g <= -6e-124) {
tmp = (Math.cbrt(((Math.sqrt(((g - h) * (h + g))) - g) * 0.5)) / Math.cbrt(a)) + Math.cbrt(((-1.0 / (a * 2.0)) * (Math.sqrt(((g * g) - (h * h))) + g)));
} else {
tmp = Math.cbrt((((0.25 * t_0) - g) / a)) + Math.cbrt(((0.5 / a) * (-0.5 * t_0)));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(Float64(h / g) * h) tmp = 0.0 if (g <= -2.5e+150) tmp = Float64(cbrt(Float64(Float64(Float64(h / a) * Float64(h / g)) * -0.25)) + cbrt(Float64(Float64(-g) / a))); elseif (g <= -6e-124) tmp = Float64(Float64(cbrt(Float64(Float64(sqrt(Float64(Float64(g - h) * Float64(h + g))) - g) * 0.5)) / cbrt(a)) + cbrt(Float64(Float64(-1.0 / Float64(a * 2.0)) * Float64(sqrt(Float64(Float64(g * g) - Float64(h * h))) + g)))); else tmp = Float64(cbrt(Float64(Float64(Float64(0.25 * t_0) - g) / a)) + cbrt(Float64(Float64(0.5 / a) * Float64(-0.5 * t_0)))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[(h / g), $MachinePrecision] * h), $MachinePrecision]}, If[LessEqual[g, -2.5e+150], N[(N[Power[N[(N[(N[(h / a), $MachinePrecision] * N[(h / g), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, -6e-124], N[(N[(N[Power[N[(N[(N[Sqrt[N[(N[(g - h), $MachinePrecision] * N[(h + g), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - g), $MachinePrecision] * 0.5), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(-1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(N[(0.25 * t$95$0), $MachinePrecision] - g), $MachinePrecision] / a), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{h}{g} \cdot h\\
\mathbf{if}\;g \leq -2.5 \cdot 10^{+150}:\\
\;\;\;\;\sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\
\mathbf{elif}\;g \leq -6 \cdot 10^{-124}:\\
\;\;\;\;\frac{\sqrt[3]{\left(\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g\right) \cdot 0.5}}{\sqrt[3]{a}} + \sqrt[3]{\frac{-1}{a \cdot 2} \cdot \left(\sqrt{g \cdot g - h \cdot h} + g\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{0.25 \cdot t\_0 - g}{a}} + \sqrt[3]{\frac{0.5}{a} \cdot \left(-0.5 \cdot t\_0\right)}\\
\end{array}
\end{array}
if g < -2.50000000000000004e150Initial program 3.0%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f643.9
Applied rewrites3.9%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6462.5
Applied rewrites62.5%
Taylor expanded in g around inf
lower-*.f64N/A
lower-cbrt.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cbrt.f64N/A
lower-cbrt.f6464.0
Applied rewrites64.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6464.0
Applied rewrites64.0%
if -2.50000000000000004e150 < g < -6e-124Initial program 75.7%
lift-cbrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
cbrt-divN/A
lower-/.f64N/A
Applied rewrites97.9%
if -6e-124 < g Initial program 46.6%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6443.4
Applied rewrites43.4%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6477.4
Applied rewrites77.4%
Taylor expanded in h around 0
+-commutativeN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6477.5
Applied rewrites77.5%
Applied rewrites81.0%
Final simplification80.7%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (/ h g) h)) (t_1 (sqrt (* (- g h) (+ h g)))))
(if (<= g -2.1e+152)
(+ (cbrt (* (* (/ h a) (/ h g)) -0.25)) (cbrt (/ (- g) a)))
(if (<= g -6e-124)
(fma
(cbrt (/ 0.5 a))
(cbrt (- t_1 g))
(cbrt (* (/ 0.5 (- a)) (+ t_1 g))))
(+
(cbrt (/ (- (* 0.25 t_0) g) a))
(cbrt (* (/ 0.5 a) (* -0.5 t_0))))))))
double code(double g, double h, double a) {
double t_0 = (h / g) * h;
double t_1 = sqrt(((g - h) * (h + g)));
double tmp;
if (g <= -2.1e+152) {
tmp = cbrt((((h / a) * (h / g)) * -0.25)) + cbrt((-g / a));
} else if (g <= -6e-124) {
tmp = fma(cbrt((0.5 / a)), cbrt((t_1 - g)), cbrt(((0.5 / -a) * (t_1 + g))));
} else {
tmp = cbrt((((0.25 * t_0) - g) / a)) + cbrt(((0.5 / a) * (-0.5 * t_0)));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(Float64(h / g) * h) t_1 = sqrt(Float64(Float64(g - h) * Float64(h + g))) tmp = 0.0 if (g <= -2.1e+152) tmp = Float64(cbrt(Float64(Float64(Float64(h / a) * Float64(h / g)) * -0.25)) + cbrt(Float64(Float64(-g) / a))); elseif (g <= -6e-124) tmp = fma(cbrt(Float64(0.5 / a)), cbrt(Float64(t_1 - g)), cbrt(Float64(Float64(0.5 / Float64(-a)) * Float64(t_1 + g)))); else tmp = Float64(cbrt(Float64(Float64(Float64(0.25 * t_0) - g) / a)) + cbrt(Float64(Float64(0.5 / a) * Float64(-0.5 * t_0)))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[(h / g), $MachinePrecision] * h), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g - h), $MachinePrecision] * N[(h + g), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[g, -2.1e+152], N[(N[Power[N[(N[(N[(h / a), $MachinePrecision] * N[(h / g), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, -6e-124], N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(t$95$1 - g), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(0.5 / (-a)), $MachinePrecision] * N[(t$95$1 + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(N[(0.25 * t$95$0), $MachinePrecision] - g), $MachinePrecision] / a), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{h}{g} \cdot h\\
t_1 := \sqrt{\left(g - h\right) \cdot \left(h + g\right)}\\
\mathbf{if}\;g \leq -2.1 \cdot 10^{+152}:\\
\;\;\;\;\sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\
\mathbf{elif}\;g \leq -6 \cdot 10^{-124}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{\frac{0.5}{a}}, \sqrt[3]{t\_1 - g}, \sqrt[3]{\frac{0.5}{-a} \cdot \left(t\_1 + g\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{0.25 \cdot t\_0 - g}{a}} + \sqrt[3]{\frac{0.5}{a} \cdot \left(-0.5 \cdot t\_0\right)}\\
\end{array}
\end{array}
if g < -2.1000000000000002e152Initial program 1.5%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f643.7
Applied rewrites3.7%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6461.9
Applied rewrites61.9%
Taylor expanded in g around inf
lower-*.f64N/A
lower-cbrt.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cbrt.f64N/A
lower-cbrt.f6463.4
Applied rewrites63.4%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6463.4
Applied rewrites63.4%
if -2.1000000000000002e152 < g < -6e-124Initial program 76.1%
lift-cbrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
cbrt-prodN/A
lower-*.f64N/A
lower-cbrt.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-cbrt.f64N/A
div-invN/A
metadata-evalN/A
Applied rewrites98.0%
Applied rewrites97.8%
if -6e-124 < g Initial program 46.6%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6443.4
Applied rewrites43.4%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6477.4
Applied rewrites77.4%
Taylor expanded in h around 0
+-commutativeN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6477.5
Applied rewrites77.5%
Applied rewrites81.0%
Final simplification80.7%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (/ h g) h)))
(if (<= g -4.6e+145)
(+ (cbrt (* (* (/ h a) (/ h g)) -0.25)) (cbrt (/ (- g) a)))
(if (<= g -1.55e-87)
(+
(cbrt (* (/ -1.0 (* a 2.0)) (+ (- g) g)))
(/ (cbrt (- (sqrt (* (- g h) (+ h g))) g)) (cbrt (* a 2.0))))
(+
(cbrt (/ (- (* 0.25 t_0) g) a))
(cbrt (* (/ 0.5 a) (* -0.5 t_0))))))))
double code(double g, double h, double a) {
double t_0 = (h / g) * h;
double tmp;
if (g <= -4.6e+145) {
tmp = cbrt((((h / a) * (h / g)) * -0.25)) + cbrt((-g / a));
} else if (g <= -1.55e-87) {
tmp = cbrt(((-1.0 / (a * 2.0)) * (-g + g))) + (cbrt((sqrt(((g - h) * (h + g))) - g)) / cbrt((a * 2.0)));
} else {
tmp = cbrt((((0.25 * t_0) - g) / a)) + cbrt(((0.5 / a) * (-0.5 * t_0)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = (h / g) * h;
double tmp;
if (g <= -4.6e+145) {
tmp = Math.cbrt((((h / a) * (h / g)) * -0.25)) + Math.cbrt((-g / a));
} else if (g <= -1.55e-87) {
tmp = Math.cbrt(((-1.0 / (a * 2.0)) * (-g + g))) + (Math.cbrt((Math.sqrt(((g - h) * (h + g))) - g)) / Math.cbrt((a * 2.0)));
} else {
tmp = Math.cbrt((((0.25 * t_0) - g) / a)) + Math.cbrt(((0.5 / a) * (-0.5 * t_0)));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(Float64(h / g) * h) tmp = 0.0 if (g <= -4.6e+145) tmp = Float64(cbrt(Float64(Float64(Float64(h / a) * Float64(h / g)) * -0.25)) + cbrt(Float64(Float64(-g) / a))); elseif (g <= -1.55e-87) tmp = Float64(cbrt(Float64(Float64(-1.0 / Float64(a * 2.0)) * Float64(Float64(-g) + g))) + Float64(cbrt(Float64(sqrt(Float64(Float64(g - h) * Float64(h + g))) - g)) / cbrt(Float64(a * 2.0)))); else tmp = Float64(cbrt(Float64(Float64(Float64(0.25 * t_0) - g) / a)) + cbrt(Float64(Float64(0.5 / a) * Float64(-0.5 * t_0)))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[(h / g), $MachinePrecision] * h), $MachinePrecision]}, If[LessEqual[g, -4.6e+145], N[(N[Power[N[(N[(N[(h / a), $MachinePrecision] * N[(h / g), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, -1.55e-87], N[(N[Power[N[(N[(-1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[((-g) + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[N[(N[Sqrt[N[(N[(g - h), $MachinePrecision] * N[(h + g), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - g), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[N[(a * 2.0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(N[(0.25 * t$95$0), $MachinePrecision] - g), $MachinePrecision] / a), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{h}{g} \cdot h\\
\mathbf{if}\;g \leq -4.6 \cdot 10^{+145}:\\
\;\;\;\;\sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\
\mathbf{elif}\;g \leq -1.55 \cdot 10^{-87}:\\
\;\;\;\;\sqrt[3]{\frac{-1}{a \cdot 2} \cdot \left(\left(-g\right) + g\right)} + \frac{\sqrt[3]{\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g}}{\sqrt[3]{a \cdot 2}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{0.25 \cdot t\_0 - g}{a}} + \sqrt[3]{\frac{0.5}{a} \cdot \left(-0.5 \cdot t\_0\right)}\\
\end{array}
\end{array}
if g < -4.6e145Initial program 4.4%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f644.1
Applied rewrites4.1%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in g around inf
lower-*.f64N/A
lower-cbrt.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cbrt.f64N/A
lower-cbrt.f6464.5
Applied rewrites64.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6464.5
Applied rewrites64.5%
if -4.6e145 < g < -1.54999999999999999e-87Initial program 73.9%
lift-cbrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
cbrt-divN/A
*-lft-identityN/A
pow1/3N/A
lower-/.f64N/A
Applied rewrites98.2%
Taylor expanded in g around -inf
mul-1-negN/A
lower-neg.f6495.6
Applied rewrites95.6%
if -1.54999999999999999e-87 < g Initial program 48.1%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6442.6
Applied rewrites42.6%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6477.7
Applied rewrites77.7%
Taylor expanded in h around 0
+-commutativeN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6477.9
Applied rewrites77.9%
Applied rewrites81.3%
Final simplification80.1%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (/ h g) h)))
(if (<= g -4.6e+145)
(+ (cbrt (* (* (/ h a) (/ h g)) -0.25)) (cbrt (/ (- g) a)))
(if (<= g -0.00021)
(+
(cbrt (/ (* (* h h) -0.25) (* a g)))
(/ (cbrt (- (sqrt (* (- g h) (+ h g))) g)) (cbrt (* a 2.0))))
(+
(cbrt (/ (- (* 0.25 t_0) g) a))
(cbrt (* (/ 0.5 a) (* -0.5 t_0))))))))
double code(double g, double h, double a) {
double t_0 = (h / g) * h;
double tmp;
if (g <= -4.6e+145) {
tmp = cbrt((((h / a) * (h / g)) * -0.25)) + cbrt((-g / a));
} else if (g <= -0.00021) {
tmp = cbrt((((h * h) * -0.25) / (a * g))) + (cbrt((sqrt(((g - h) * (h + g))) - g)) / cbrt((a * 2.0)));
} else {
tmp = cbrt((((0.25 * t_0) - g) / a)) + cbrt(((0.5 / a) * (-0.5 * t_0)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = (h / g) * h;
double tmp;
if (g <= -4.6e+145) {
tmp = Math.cbrt((((h / a) * (h / g)) * -0.25)) + Math.cbrt((-g / a));
} else if (g <= -0.00021) {
tmp = Math.cbrt((((h * h) * -0.25) / (a * g))) + (Math.cbrt((Math.sqrt(((g - h) * (h + g))) - g)) / Math.cbrt((a * 2.0)));
} else {
tmp = Math.cbrt((((0.25 * t_0) - g) / a)) + Math.cbrt(((0.5 / a) * (-0.5 * t_0)));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(Float64(h / g) * h) tmp = 0.0 if (g <= -4.6e+145) tmp = Float64(cbrt(Float64(Float64(Float64(h / a) * Float64(h / g)) * -0.25)) + cbrt(Float64(Float64(-g) / a))); elseif (g <= -0.00021) tmp = Float64(cbrt(Float64(Float64(Float64(h * h) * -0.25) / Float64(a * g))) + Float64(cbrt(Float64(sqrt(Float64(Float64(g - h) * Float64(h + g))) - g)) / cbrt(Float64(a * 2.0)))); else tmp = Float64(cbrt(Float64(Float64(Float64(0.25 * t_0) - g) / a)) + cbrt(Float64(Float64(0.5 / a) * Float64(-0.5 * t_0)))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[(h / g), $MachinePrecision] * h), $MachinePrecision]}, If[LessEqual[g, -4.6e+145], N[(N[Power[N[(N[(N[(h / a), $MachinePrecision] * N[(h / g), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, -0.00021], N[(N[Power[N[(N[(N[(h * h), $MachinePrecision] * -0.25), $MachinePrecision] / N[(a * g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[N[(N[Sqrt[N[(N[(g - h), $MachinePrecision] * N[(h + g), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - g), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[N[(a * 2.0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(N[(0.25 * t$95$0), $MachinePrecision] - g), $MachinePrecision] / a), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{h}{g} \cdot h\\
\mathbf{if}\;g \leq -4.6 \cdot 10^{+145}:\\
\;\;\;\;\sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\
\mathbf{elif}\;g \leq -0.00021:\\
\;\;\;\;\sqrt[3]{\frac{\left(h \cdot h\right) \cdot -0.25}{a \cdot g}} + \frac{\sqrt[3]{\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g}}{\sqrt[3]{a \cdot 2}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{0.25 \cdot t\_0 - g}{a}} + \sqrt[3]{\frac{0.5}{a} \cdot \left(-0.5 \cdot t\_0\right)}\\
\end{array}
\end{array}
if g < -4.6e145Initial program 4.4%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f644.1
Applied rewrites4.1%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in g around inf
lower-*.f64N/A
lower-cbrt.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cbrt.f64N/A
lower-cbrt.f6464.5
Applied rewrites64.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6464.5
Applied rewrites64.5%
if -4.6e145 < g < -2.1000000000000001e-4Initial program 67.5%
lift-cbrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
cbrt-divN/A
*-lft-identityN/A
pow1/3N/A
lower-/.f64N/A
Applied rewrites98.1%
Taylor expanded in g around -inf
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6496.1
Applied rewrites96.1%
if -2.1000000000000001e-4 < g Initial program 52.7%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6440.0
Applied rewrites40.0%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6479.3
Applied rewrites79.3%
Taylor expanded in h around 0
+-commutativeN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6479.5
Applied rewrites79.5%
Applied rewrites82.5%
Final simplification80.0%
(FPCore (g h a) :precision binary64 (let* ((t_0 (* (/ h g) h))) (+ (cbrt (/ (- (* 0.25 t_0) g) a)) (cbrt (* (/ 0.5 a) (* -0.5 t_0))))))
double code(double g, double h, double a) {
double t_0 = (h / g) * h;
return cbrt((((0.25 * t_0) - g) / a)) + cbrt(((0.5 / a) * (-0.5 * t_0)));
}
public static double code(double g, double h, double a) {
double t_0 = (h / g) * h;
return Math.cbrt((((0.25 * t_0) - g) / a)) + Math.cbrt(((0.5 / a) * (-0.5 * t_0)));
}
function code(g, h, a) t_0 = Float64(Float64(h / g) * h) return Float64(cbrt(Float64(Float64(Float64(0.25 * t_0) - g) / a)) + cbrt(Float64(Float64(0.5 / a) * Float64(-0.5 * t_0)))) end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[(h / g), $MachinePrecision] * h), $MachinePrecision]}, N[(N[Power[N[(N[(N[(0.25 * t$95$0), $MachinePrecision] - g), $MachinePrecision] / a), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{h}{g} \cdot h\\
\sqrt[3]{\frac{0.25 \cdot t\_0 - g}{a}} + \sqrt[3]{\frac{0.5}{a} \cdot \left(-0.5 \cdot t\_0\right)}
\end{array}
\end{array}
Initial program 42.3%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6426.1
Applied rewrites26.1%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6472.6
Applied rewrites72.6%
Taylor expanded in h around 0
+-commutativeN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6472.6
Applied rewrites72.6%
Applied rewrites74.8%
Final simplification74.8%
(FPCore (g h a) :precision binary64 (+ (cbrt (* (* (/ h a) (/ h g)) -0.25)) (cbrt (/ (- g) a))))
double code(double g, double h, double a) {
return cbrt((((h / a) * (h / g)) * -0.25)) + cbrt((-g / a));
}
public static double code(double g, double h, double a) {
return Math.cbrt((((h / a) * (h / g)) * -0.25)) + Math.cbrt((-g / a));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(Float64(h / a) * Float64(h / g)) * -0.25)) + cbrt(Float64(Float64(-g) / a))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(N[(h / a), $MachinePrecision] * N[(h / g), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\left(\frac{h}{a} \cdot \frac{h}{g}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}
\end{array}
Initial program 42.3%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6426.1
Applied rewrites26.1%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6472.6
Applied rewrites72.6%
Taylor expanded in g around inf
lower-*.f64N/A
lower-cbrt.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cbrt.f64N/A
lower-cbrt.f6474.5
Applied rewrites74.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.5
Applied rewrites74.5%
Final simplification74.5%
(FPCore (g h a) :precision binary64 (+ (cbrt (* (/ (* h h) g) (/ -0.25 a))) (cbrt (/ (- g) a))))
double code(double g, double h, double a) {
return cbrt((((h * h) / g) * (-0.25 / a))) + cbrt((-g / a));
}
public static double code(double g, double h, double a) {
return Math.cbrt((((h * h) / g) * (-0.25 / a))) + Math.cbrt((-g / a));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(Float64(h * h) / g) * Float64(-0.25 / a))) + cbrt(Float64(Float64(-g) / a))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(N[(h * h), $MachinePrecision] / g), $MachinePrecision] * N[(-0.25 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{h \cdot h}{g} \cdot \frac{-0.25}{a}} + \sqrt[3]{\frac{-g}{a}}
\end{array}
Initial program 42.3%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6426.1
Applied rewrites26.1%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6472.6
Applied rewrites72.6%
Taylor expanded in g around inf
associate-*r/N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6472.6
Applied rewrites72.6%
Final simplification72.6%
(FPCore (g h a) :precision binary64 (+ (cbrt (* (/ (* -2.0 g) a) 0.5)) (cbrt (/ (- g) a))))
double code(double g, double h, double a) {
return cbrt((((-2.0 * g) / a) * 0.5)) + cbrt((-g / a));
}
public static double code(double g, double h, double a) {
return Math.cbrt((((-2.0 * g) / a) * 0.5)) + Math.cbrt((-g / a));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(Float64(-2.0 * g) / a) * 0.5)) + cbrt(Float64(Float64(-g) / a))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(N[(-2.0 * g), $MachinePrecision] / a), $MachinePrecision] * 0.5), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{-2 \cdot g}{a} \cdot 0.5} + \sqrt[3]{\frac{-g}{a}}
\end{array}
Initial program 42.3%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6426.1
Applied rewrites26.1%
Taylor expanded in g around -inf
lower-*.f6415.3
Applied rewrites15.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f6415.3
Applied rewrites15.3%
Final simplification15.3%
(FPCore (g h a) :precision binary64 (let* ((t_0 (cbrt (/ (- g) a)))) (+ t_0 t_0)))
double code(double g, double h, double a) {
double t_0 = cbrt((-g / a));
return t_0 + t_0;
}
public static double code(double g, double h, double a) {
double t_0 = Math.cbrt((-g / a));
return t_0 + t_0;
}
function code(g, h, a) t_0 = cbrt(Float64(Float64(-g) / a)) return Float64(t_0 + t_0) end
code[g_, h_, a_] := Block[{t$95$0 = N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]}, N[(t$95$0 + t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\frac{-g}{a}}\\
t\_0 + t\_0
\end{array}
\end{array}
Initial program 42.3%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6426.1
Applied rewrites26.1%
Taylor expanded in g around inf
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6472.6
Applied rewrites72.6%
Taylor expanded in g around -inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6415.3
Applied rewrites15.3%
(FPCore (g h a) :precision binary64 (* (- (cbrt 0.5)) (cbrt (/ 0.0 a))))
double code(double g, double h, double a) {
return -cbrt(0.5) * cbrt((0.0 / a));
}
public static double code(double g, double h, double a) {
return -Math.cbrt(0.5) * Math.cbrt((0.0 / a));
}
function code(g, h, a) return Float64(Float64(-cbrt(0.5)) * cbrt(Float64(0.0 / a))) end
code[g_, h_, a_] := N[((-N[Power[0.5, 1/3], $MachinePrecision]) * N[Power[N[(0.0 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-\sqrt[3]{0.5}\right) \cdot \sqrt[3]{\frac{0}{a}}
\end{array}
Initial program 42.3%
lift-cbrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
cbrt-prodN/A
lower-*.f64N/A
lower-cbrt.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-cbrt.f64N/A
div-invN/A
metadata-evalN/A
Applied rewrites47.9%
Taylor expanded in g around -inf
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
*-commutativeN/A
+-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
metadata-evalN/A
mul0-lftN/A
mul0-lftN/A
metadata-evalN/A
distribute-rgt1-inN/A
lower-cbrt.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
lower-/.f64N/A
lower-cbrt.f642.9
Applied rewrites2.9%
Final simplification2.9%
herbie shell --seed 2024267
(FPCore (g h a)
:name "2-ancestry mixing, positive discriminant"
:precision binary64
(+ (cbrt (* (/ 1.0 (* 2.0 a)) (+ (- g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1.0 (* 2.0 a)) (- (- g) (sqrt (- (* g g) (* h h))))))))