
(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 11 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 (* (* (cbrt g) (cbrt (/ 1.0 a))) (* (cbrt -0.5) (cbrt 2.0))))
(t_1 (* (cbrt -0.5) (cbrt 0.5))))
(if (<= (* h h) 1e-200)
(+ t_0 (* (/ 1.0 (cbrt (* g (/ a (pow h 2.0))))) t_1))
(+ t_0 (* t_1 (/ (pow (cbrt h) 2.0) (cbrt (* g a))))))))
double code(double g, double h, double a) {
double t_0 = (cbrt(g) * cbrt((1.0 / a))) * (cbrt(-0.5) * cbrt(2.0));
double t_1 = cbrt(-0.5) * cbrt(0.5);
double tmp;
if ((h * h) <= 1e-200) {
tmp = t_0 + ((1.0 / cbrt((g * (a / pow(h, 2.0))))) * t_1);
} else {
tmp = t_0 + (t_1 * (pow(cbrt(h), 2.0) / cbrt((g * a))));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = (Math.cbrt(g) * Math.cbrt((1.0 / a))) * (Math.cbrt(-0.5) * Math.cbrt(2.0));
double t_1 = Math.cbrt(-0.5) * Math.cbrt(0.5);
double tmp;
if ((h * h) <= 1e-200) {
tmp = t_0 + ((1.0 / Math.cbrt((g * (a / Math.pow(h, 2.0))))) * t_1);
} else {
tmp = t_0 + (t_1 * (Math.pow(Math.cbrt(h), 2.0) / Math.cbrt((g * a))));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(Float64(cbrt(g) * cbrt(Float64(1.0 / a))) * Float64(cbrt(-0.5) * cbrt(2.0))) t_1 = Float64(cbrt(-0.5) * cbrt(0.5)) tmp = 0.0 if (Float64(h * h) <= 1e-200) tmp = Float64(t_0 + Float64(Float64(1.0 / cbrt(Float64(g * Float64(a / (h ^ 2.0))))) * t_1)); else tmp = Float64(t_0 + Float64(t_1 * Float64((cbrt(h) ^ 2.0) / cbrt(Float64(g * a))))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[N[(1.0 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[0.5, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h * h), $MachinePrecision], 1e-200], N[(t$95$0 + N[(N[(1.0 / N[Power[N[(g * N[(a / N[Power[h, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(t$95$1 * N[(N[Power[N[Power[h, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[(g * a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\sqrt[3]{g} \cdot \sqrt[3]{\frac{1}{a}}\right) \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right)\\
t_1 := \sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\\
\mathbf{if}\;h \cdot h \leq 10^{-200}:\\
\;\;\;\;t\_0 + \frac{1}{\sqrt[3]{g \cdot \frac{a}{{h}^{2}}}} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0 + t\_1 \cdot \frac{{\left(\sqrt[3]{h}\right)}^{2}}{\sqrt[3]{g \cdot a}}\\
\end{array}
\end{array}
if (*.f64 h h) < 9.9999999999999998e-201Initial program 54.1%
Simplified54.1%
Taylor expanded in h around 0 67.1%
pow1/333.2%
div-inv33.2%
unpow-prod-down17.5%
pow1/337.5%
Applied egg-rr37.5%
unpow1/389.0%
Simplified89.0%
clear-num89.0%
*-commutative89.0%
cbrt-div89.0%
metadata-eval89.0%
Applied egg-rr89.0%
associate-/l*96.9%
Simplified96.9%
if 9.9999999999999998e-201 < (*.f64 h h) Initial program 27.1%
Simplified27.1%
Taylor expanded in h around 0 52.7%
pow1/327.0%
div-inv27.0%
unpow-prod-down24.8%
pow1/341.2%
Applied egg-rr41.2%
unpow1/377.8%
Simplified77.8%
cbrt-div81.0%
*-commutative81.0%
unpow281.0%
cbrt-prod95.1%
pow295.1%
Applied egg-rr95.1%
Final simplification96.2%
(FPCore (g h a)
:precision binary64
(let* ((t_0
(+
(* (* (cbrt -0.5) (cbrt 0.5)) (/ (pow (cbrt h) 2.0) (cbrt (* g a))))
(* (* (cbrt -0.5) (cbrt 2.0)) (cbrt (/ g a)))))
(t_1 (sqrt (- (* g g) (* h h)))))
(if (<= g -1.34e+154)
t_0
(if (<= g -1.1e-141)
(+
(*
(cbrt 0.5)
(* (cbrt (/ 1.0 a)) (cbrt (- (sqrt (* (- g h) (+ h g))) g))))
(cbrt (* (+ g t_1) (/ -0.5 a))))
(if (<= g 4.3e-172)
(fma
(cbrt (/ (* g -0.5) a))
(cbrt 2.0)
(cbrt (* (/ (pow h 2.0) g) (/ -0.25 a))))
(if (<= g 1.35e+154)
(+
(cbrt (* (/ 0.5 a) (- t_1 g)))
(/
(cbrt (* -0.5 (+ g (sqrt (- (pow g 2.0) (pow h 2.0))))))
(cbrt a)))
t_0))))))
double code(double g, double h, double a) {
double t_0 = ((cbrt(-0.5) * cbrt(0.5)) * (pow(cbrt(h), 2.0) / cbrt((g * a)))) + ((cbrt(-0.5) * cbrt(2.0)) * cbrt((g / a)));
double t_1 = sqrt(((g * g) - (h * h)));
double tmp;
if (g <= -1.34e+154) {
tmp = t_0;
} else if (g <= -1.1e-141) {
tmp = (cbrt(0.5) * (cbrt((1.0 / a)) * cbrt((sqrt(((g - h) * (h + g))) - g)))) + cbrt(((g + t_1) * (-0.5 / a)));
} else if (g <= 4.3e-172) {
tmp = fma(cbrt(((g * -0.5) / a)), cbrt(2.0), cbrt(((pow(h, 2.0) / g) * (-0.25 / a))));
} else if (g <= 1.35e+154) {
tmp = cbrt(((0.5 / a) * (t_1 - g))) + (cbrt((-0.5 * (g + sqrt((pow(g, 2.0) - pow(h, 2.0)))))) / cbrt(a));
} else {
tmp = t_0;
}
return tmp;
}
function code(g, h, a) t_0 = Float64(Float64(Float64(cbrt(-0.5) * cbrt(0.5)) * Float64((cbrt(h) ^ 2.0) / cbrt(Float64(g * a)))) + Float64(Float64(cbrt(-0.5) * cbrt(2.0)) * cbrt(Float64(g / a)))) t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h))) tmp = 0.0 if (g <= -1.34e+154) tmp = t_0; elseif (g <= -1.1e-141) tmp = Float64(Float64(cbrt(0.5) * Float64(cbrt(Float64(1.0 / a)) * cbrt(Float64(sqrt(Float64(Float64(g - h) * Float64(h + g))) - g)))) + cbrt(Float64(Float64(g + t_1) * Float64(-0.5 / a)))); elseif (g <= 4.3e-172) tmp = fma(cbrt(Float64(Float64(g * -0.5) / a)), cbrt(2.0), cbrt(Float64(Float64((h ^ 2.0) / g) * Float64(-0.25 / a)))); elseif (g <= 1.35e+154) tmp = Float64(cbrt(Float64(Float64(0.5 / a) * Float64(t_1 - g))) + Float64(cbrt(Float64(-0.5 * Float64(g + sqrt(Float64((g ^ 2.0) - (h ^ 2.0)))))) / cbrt(a))); else tmp = t_0; end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[0.5, 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Power[h, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[(g * a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[g, -1.34e+154], t$95$0, If[LessEqual[g, -1.1e-141], N[(N[(N[Power[0.5, 1/3], $MachinePrecision] * N[(N[Power[N[(1.0 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(N[Sqrt[N[(N[(g - h), $MachinePrecision] * N[(h + g), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(g + t$95$1), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, 4.3e-172], N[(N[Power[N[(N[(g * -0.5), $MachinePrecision] / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision] + N[Power[N[(N[(N[Power[h, 2.0], $MachinePrecision] / g), $MachinePrecision] * N[(-0.25 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, 1.35e+154], N[(N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(t$95$1 - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[N[(-0.5 * N[(g + N[Sqrt[N[(N[Power[g, 2.0], $MachinePrecision] - N[Power[h, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right) \cdot \frac{{\left(\sqrt[3]{h}\right)}^{2}}{\sqrt[3]{g \cdot a}} + \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right) \cdot \sqrt[3]{\frac{g}{a}}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
\mathbf{if}\;g \leq -1.34 \cdot 10^{+154}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;g \leq -1.1 \cdot 10^{-141}:\\
\;\;\;\;\sqrt[3]{0.5} \cdot \left(\sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g}\right) + \sqrt[3]{\left(g + t\_1\right) \cdot \frac{-0.5}{a}}\\
\mathbf{elif}\;g \leq 4.3 \cdot 10^{-172}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{\frac{g \cdot -0.5}{a}}, \sqrt[3]{2}, \sqrt[3]{\frac{{h}^{2}}{g} \cdot \frac{-0.25}{a}}\right)\\
\mathbf{elif}\;g \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\sqrt[3]{\frac{0.5}{a} \cdot \left(t\_1 - g\right)} + \frac{\sqrt[3]{-0.5 \cdot \left(g + \sqrt{{g}^{2} - {h}^{2}}\right)}}{\sqrt[3]{a}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if g < -1.34000000000000001e154 or 1.35000000000000003e154 < g Initial program 0.0%
Simplified0.0%
Taylor expanded in h around 0 46.8%
cbrt-div83.6%
*-commutative83.6%
unpow283.6%
cbrt-prod96.7%
pow296.7%
Applied egg-rr54.3%
if -1.34000000000000001e154 < g < -1.10000000000000005e-141Initial program 85.3%
Simplified85.3%
pow1/285.3%
difference-of-squares85.3%
unpow-prod-down0.0%
Applied egg-rr0.0%
unpow1/20.0%
unpow1/20.0%
+-commutative0.0%
Simplified0.0%
Taylor expanded in a around 0 85.3%
+-commutative85.3%
Simplified85.3%
pow1/336.8%
div-inv36.8%
unpow-prod-down39.4%
pow1/339.3%
Applied egg-rr39.3%
unpow1/398.0%
*-commutative98.0%
+-commutative98.0%
Simplified98.0%
if -1.10000000000000005e-141 < g < 4.2999999999999997e-172Initial program 18.6%
Simplified18.6%
Taylor expanded in h around 0 31.9%
add-cube-cbrt31.4%
pow331.5%
Applied egg-rr31.5%
rem-cube-cbrt31.9%
associate-*r*31.9%
fma-define31.9%
cbrt-unprod31.9%
rem-3cbrt-lft31.9%
cbrt-unprod31.9%
cbrt-prod31.9%
Applied egg-rr31.9%
associate-*l/31.9%
associate-*l/31.9%
times-frac68.1%
Simplified68.1%
if 4.2999999999999997e-172 < g < 1.35000000000000003e154Initial program 80.1%
Simplified80.1%
associate-*r/80.1%
cbrt-div95.5%
pow295.5%
pow295.5%
Applied egg-rr95.5%
Final simplification77.5%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (cbrt -0.5) (cbrt 2.0)))
(t_1 (* (* (cbrt g) (cbrt (/ 1.0 a))) t_0))
(t_2 (* (cbrt -0.5) (cbrt 0.5))))
(if (<= (* h h) 1e-200)
(+ t_1 (* (/ 1.0 (cbrt (* g (/ a (pow h 2.0))))) t_2))
(if (<= (* h h) 2e+282)
(+ t_1 (* t_2 (cbrt (/ (pow h 2.0) (* g a)))))
(+
(* t_2 (/ (pow (cbrt h) 2.0) (cbrt (* g a))))
(* t_0 (cbrt (/ g a))))))))
double code(double g, double h, double a) {
double t_0 = cbrt(-0.5) * cbrt(2.0);
double t_1 = (cbrt(g) * cbrt((1.0 / a))) * t_0;
double t_2 = cbrt(-0.5) * cbrt(0.5);
double tmp;
if ((h * h) <= 1e-200) {
tmp = t_1 + ((1.0 / cbrt((g * (a / pow(h, 2.0))))) * t_2);
} else if ((h * h) <= 2e+282) {
tmp = t_1 + (t_2 * cbrt((pow(h, 2.0) / (g * a))));
} else {
tmp = (t_2 * (pow(cbrt(h), 2.0) / cbrt((g * a)))) + (t_0 * cbrt((g / a)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.cbrt(-0.5) * Math.cbrt(2.0);
double t_1 = (Math.cbrt(g) * Math.cbrt((1.0 / a))) * t_0;
double t_2 = Math.cbrt(-0.5) * Math.cbrt(0.5);
double tmp;
if ((h * h) <= 1e-200) {
tmp = t_1 + ((1.0 / Math.cbrt((g * (a / Math.pow(h, 2.0))))) * t_2);
} else if ((h * h) <= 2e+282) {
tmp = t_1 + (t_2 * Math.cbrt((Math.pow(h, 2.0) / (g * a))));
} else {
tmp = (t_2 * (Math.pow(Math.cbrt(h), 2.0) / Math.cbrt((g * a)))) + (t_0 * Math.cbrt((g / a)));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(cbrt(-0.5) * cbrt(2.0)) t_1 = Float64(Float64(cbrt(g) * cbrt(Float64(1.0 / a))) * t_0) t_2 = Float64(cbrt(-0.5) * cbrt(0.5)) tmp = 0.0 if (Float64(h * h) <= 1e-200) tmp = Float64(t_1 + Float64(Float64(1.0 / cbrt(Float64(g * Float64(a / (h ^ 2.0))))) * t_2)); elseif (Float64(h * h) <= 2e+282) tmp = Float64(t_1 + Float64(t_2 * cbrt(Float64((h ^ 2.0) / Float64(g * a))))); else tmp = Float64(Float64(t_2 * Float64((cbrt(h) ^ 2.0) / cbrt(Float64(g * a)))) + Float64(t_0 * cbrt(Float64(g / a)))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[N[(1.0 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[0.5, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h * h), $MachinePrecision], 1e-200], N[(t$95$1 + N[(N[(1.0 / N[Power[N[(g * N[(a / N[Power[h, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h * h), $MachinePrecision], 2e+282], N[(t$95$1 + N[(t$95$2 * N[Power[N[(N[Power[h, 2.0], $MachinePrecision] / N[(g * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 * N[(N[Power[N[Power[h, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[(g * a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{-0.5} \cdot \sqrt[3]{2}\\
t_1 := \left(\sqrt[3]{g} \cdot \sqrt[3]{\frac{1}{a}}\right) \cdot t\_0\\
t_2 := \sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\\
\mathbf{if}\;h \cdot h \leq 10^{-200}:\\
\;\;\;\;t\_1 + \frac{1}{\sqrt[3]{g \cdot \frac{a}{{h}^{2}}}} \cdot t\_2\\
\mathbf{elif}\;h \cdot h \leq 2 \cdot 10^{+282}:\\
\;\;\;\;t\_1 + t\_2 \cdot \sqrt[3]{\frac{{h}^{2}}{g \cdot a}}\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \frac{{\left(\sqrt[3]{h}\right)}^{2}}{\sqrt[3]{g \cdot a}} + t\_0 \cdot \sqrt[3]{\frac{g}{a}}\\
\end{array}
\end{array}
if (*.f64 h h) < 9.9999999999999998e-201Initial program 54.1%
Simplified54.1%
Taylor expanded in h around 0 67.1%
pow1/333.2%
div-inv33.2%
unpow-prod-down17.5%
pow1/337.5%
Applied egg-rr37.5%
unpow1/389.0%
Simplified89.0%
clear-num89.0%
*-commutative89.0%
cbrt-div89.0%
metadata-eval89.0%
Applied egg-rr89.0%
associate-/l*96.9%
Simplified96.9%
if 9.9999999999999998e-201 < (*.f64 h h) < 2.00000000000000007e282Initial program 34.1%
Simplified34.1%
Taylor expanded in h around 0 61.8%
pow1/329.8%
div-inv29.8%
unpow-prod-down28.4%
pow1/349.1%
Applied egg-rr49.1%
unpow1/393.4%
Simplified93.4%
if 2.00000000000000007e282 < (*.f64 h h) Initial program 0.0%
Simplified0.0%
Taylor expanded in h around 0 17.7%
cbrt-div22.5%
*-commutative22.5%
unpow222.5%
cbrt-prod90.7%
pow290.7%
Applied egg-rr56.5%
Final simplification92.9%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (* (cbrt g) (cbrt (/ 1.0 a))) (* (cbrt -0.5) (cbrt 2.0))))
(t_1 (* (cbrt -0.5) (cbrt 0.5))))
(if (<= (* h h) 4e+73)
(+ t_0 (* (/ 1.0 (cbrt (* g (/ a (pow h 2.0))))) t_1))
(+ t_0 (* t_1 (/ 1.0 (cbrt (/ (* g a) (pow h -2.0)))))))))
double code(double g, double h, double a) {
double t_0 = (cbrt(g) * cbrt((1.0 / a))) * (cbrt(-0.5) * cbrt(2.0));
double t_1 = cbrt(-0.5) * cbrt(0.5);
double tmp;
if ((h * h) <= 4e+73) {
tmp = t_0 + ((1.0 / cbrt((g * (a / pow(h, 2.0))))) * t_1);
} else {
tmp = t_0 + (t_1 * (1.0 / cbrt(((g * a) / pow(h, -2.0)))));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = (Math.cbrt(g) * Math.cbrt((1.0 / a))) * (Math.cbrt(-0.5) * Math.cbrt(2.0));
double t_1 = Math.cbrt(-0.5) * Math.cbrt(0.5);
double tmp;
if ((h * h) <= 4e+73) {
tmp = t_0 + ((1.0 / Math.cbrt((g * (a / Math.pow(h, 2.0))))) * t_1);
} else {
tmp = t_0 + (t_1 * (1.0 / Math.cbrt(((g * a) / Math.pow(h, -2.0)))));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(Float64(cbrt(g) * cbrt(Float64(1.0 / a))) * Float64(cbrt(-0.5) * cbrt(2.0))) t_1 = Float64(cbrt(-0.5) * cbrt(0.5)) tmp = 0.0 if (Float64(h * h) <= 4e+73) tmp = Float64(t_0 + Float64(Float64(1.0 / cbrt(Float64(g * Float64(a / (h ^ 2.0))))) * t_1)); else tmp = Float64(t_0 + Float64(t_1 * Float64(1.0 / cbrt(Float64(Float64(g * a) / (h ^ -2.0)))))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[N[(1.0 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[0.5, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h * h), $MachinePrecision], 4e+73], N[(t$95$0 + N[(N[(1.0 / N[Power[N[(g * N[(a / N[Power[h, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(t$95$1 * N[(1.0 / N[Power[N[(N[(g * a), $MachinePrecision] / N[Power[h, -2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\sqrt[3]{g} \cdot \sqrt[3]{\frac{1}{a}}\right) \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right)\\
t_1 := \sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\\
\mathbf{if}\;h \cdot h \leq 4 \cdot 10^{+73}:\\
\;\;\;\;t\_0 + \frac{1}{\sqrt[3]{g \cdot \frac{a}{{h}^{2}}}} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0 + t\_1 \cdot \frac{1}{\sqrt[3]{\frac{g \cdot a}{{h}^{-2}}}}\\
\end{array}
\end{array}
if (*.f64 h h) < 3.99999999999999993e73Initial program 50.7%
Simplified50.7%
Taylor expanded in h around 0 67.2%
pow1/333.0%
div-inv33.0%
unpow-prod-down20.2%
pow1/341.0%
Applied egg-rr41.0%
unpow1/390.5%
Simplified90.5%
clear-num90.5%
*-commutative90.5%
cbrt-div90.5%
metadata-eval90.5%
Applied egg-rr90.5%
associate-/l*96.6%
Simplified96.6%
if 3.99999999999999993e73 < (*.f64 h h) Initial program 12.9%
Simplified12.9%
Taylor expanded in h around 0 35.7%
pow1/320.8%
div-inv20.8%
unpow-prod-down19.4%
pow1/327.8%
Applied egg-rr27.8%
unpow1/357.5%
Simplified57.5%
clear-num57.5%
*-commutative57.5%
cbrt-div59.6%
metadata-eval59.6%
Applied egg-rr59.6%
Applied egg-rr91.7%
rem-cube-cbrt91.7%
associate-*r/91.7%
*-commutative91.7%
Simplified91.7%
Final simplification95.7%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (cbrt -0.5) (cbrt 2.0))) (t_1 (* (cbrt -0.5) (cbrt 0.5))))
(if (<= (* h h) 2e+282)
(+
(* (* (cbrt g) (cbrt (/ 1.0 a))) t_0)
(* t_1 (cbrt (/ (pow h 2.0) (* g a)))))
(+
(* t_1 (/ (pow (cbrt h) 2.0) (cbrt (* g a))))
(* t_0 (cbrt (/ g a)))))))
double code(double g, double h, double a) {
double t_0 = cbrt(-0.5) * cbrt(2.0);
double t_1 = cbrt(-0.5) * cbrt(0.5);
double tmp;
if ((h * h) <= 2e+282) {
tmp = ((cbrt(g) * cbrt((1.0 / a))) * t_0) + (t_1 * cbrt((pow(h, 2.0) / (g * a))));
} else {
tmp = (t_1 * (pow(cbrt(h), 2.0) / cbrt((g * a)))) + (t_0 * cbrt((g / a)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.cbrt(-0.5) * Math.cbrt(2.0);
double t_1 = Math.cbrt(-0.5) * Math.cbrt(0.5);
double tmp;
if ((h * h) <= 2e+282) {
tmp = ((Math.cbrt(g) * Math.cbrt((1.0 / a))) * t_0) + (t_1 * Math.cbrt((Math.pow(h, 2.0) / (g * a))));
} else {
tmp = (t_1 * (Math.pow(Math.cbrt(h), 2.0) / Math.cbrt((g * a)))) + (t_0 * Math.cbrt((g / a)));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(cbrt(-0.5) * cbrt(2.0)) t_1 = Float64(cbrt(-0.5) * cbrt(0.5)) tmp = 0.0 if (Float64(h * h) <= 2e+282) tmp = Float64(Float64(Float64(cbrt(g) * cbrt(Float64(1.0 / a))) * t_0) + Float64(t_1 * cbrt(Float64((h ^ 2.0) / Float64(g * a))))); else tmp = Float64(Float64(t_1 * Float64((cbrt(h) ^ 2.0) / cbrt(Float64(g * a)))) + Float64(t_0 * cbrt(Float64(g / a)))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[0.5, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h * h), $MachinePrecision], 2e+282], N[(N[(N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[N[(1.0 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(t$95$1 * N[Power[N[(N[Power[h, 2.0], $MachinePrecision] / N[(g * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[(N[Power[N[Power[h, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[(g * a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{-0.5} \cdot \sqrt[3]{2}\\
t_1 := \sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\\
\mathbf{if}\;h \cdot h \leq 2 \cdot 10^{+282}:\\
\;\;\;\;\left(\sqrt[3]{g} \cdot \sqrt[3]{\frac{1}{a}}\right) \cdot t\_0 + t\_1 \cdot \sqrt[3]{\frac{{h}^{2}}{g \cdot a}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{{\left(\sqrt[3]{h}\right)}^{2}}{\sqrt[3]{g \cdot a}} + t\_0 \cdot \sqrt[3]{\frac{g}{a}}\\
\end{array}
\end{array}
if (*.f64 h h) < 2.00000000000000007e282Initial program 48.0%
Simplified48.0%
Taylor expanded in h around 0 65.4%
pow1/332.2%
div-inv32.2%
unpow-prod-down20.8%
pow1/341.0%
Applied egg-rr41.0%
unpow1/390.4%
Simplified90.4%
if 2.00000000000000007e282 < (*.f64 h h) Initial program 0.0%
Simplified0.0%
Taylor expanded in h around 0 17.7%
cbrt-div22.5%
*-commutative22.5%
unpow222.5%
cbrt-prod90.7%
pow290.7%
Applied egg-rr56.5%
Final simplification87.9%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (cbrt -0.5) (cbrt 2.0))) (t_1 (* (cbrt -0.5) (cbrt 0.5))))
(if (<= (* h h) 4e+295)
(+ (* t_1 (cbrt (/ (pow h 2.0) (* g a)))) (* t_0 (/ (cbrt g) (cbrt a))))
(+
(* t_1 (/ (pow (cbrt h) 2.0) (cbrt (* g a))))
(* t_0 (cbrt (/ g a)))))))
double code(double g, double h, double a) {
double t_0 = cbrt(-0.5) * cbrt(2.0);
double t_1 = cbrt(-0.5) * cbrt(0.5);
double tmp;
if ((h * h) <= 4e+295) {
tmp = (t_1 * cbrt((pow(h, 2.0) / (g * a)))) + (t_0 * (cbrt(g) / cbrt(a)));
} else {
tmp = (t_1 * (pow(cbrt(h), 2.0) / cbrt((g * a)))) + (t_0 * cbrt((g / a)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.cbrt(-0.5) * Math.cbrt(2.0);
double t_1 = Math.cbrt(-0.5) * Math.cbrt(0.5);
double tmp;
if ((h * h) <= 4e+295) {
tmp = (t_1 * Math.cbrt((Math.pow(h, 2.0) / (g * a)))) + (t_0 * (Math.cbrt(g) / Math.cbrt(a)));
} else {
tmp = (t_1 * (Math.pow(Math.cbrt(h), 2.0) / Math.cbrt((g * a)))) + (t_0 * Math.cbrt((g / a)));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(cbrt(-0.5) * cbrt(2.0)) t_1 = Float64(cbrt(-0.5) * cbrt(0.5)) tmp = 0.0 if (Float64(h * h) <= 4e+295) tmp = Float64(Float64(t_1 * cbrt(Float64((h ^ 2.0) / Float64(g * a)))) + Float64(t_0 * Float64(cbrt(g) / cbrt(a)))); else tmp = Float64(Float64(t_1 * Float64((cbrt(h) ^ 2.0) / cbrt(Float64(g * a)))) + Float64(t_0 * cbrt(Float64(g / a)))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[0.5, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h * h), $MachinePrecision], 4e+295], N[(N[(t$95$1 * N[Power[N[(N[Power[h, 2.0], $MachinePrecision] / N[(g * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[(N[Power[N[Power[h, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[(g * a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{-0.5} \cdot \sqrt[3]{2}\\
t_1 := \sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\\
\mathbf{if}\;h \cdot h \leq 4 \cdot 10^{+295}:\\
\;\;\;\;t\_1 \cdot \sqrt[3]{\frac{{h}^{2}}{g \cdot a}} + t\_0 \cdot \frac{\sqrt[3]{g}}{\sqrt[3]{a}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{{\left(\sqrt[3]{h}\right)}^{2}}{\sqrt[3]{g \cdot a}} + t\_0 \cdot \sqrt[3]{\frac{g}{a}}\\
\end{array}
\end{array}
if (*.f64 h h) < 3.9999999999999999e295Initial program 47.2%
Simplified47.2%
Taylor expanded in h around 0 65.6%
cbrt-div89.9%
Applied egg-rr89.9%
if 3.9999999999999999e295 < (*.f64 h h) Initial program 0.0%
Simplified0.0%
Taylor expanded in h around 0 2.5%
cbrt-div2.5%
*-commutative2.5%
unpow22.5%
cbrt-prod88.9%
pow288.9%
Applied egg-rr51.8%
Final simplification87.7%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (sqrt (- (* g g) (* h h))))
(t_1 (* (* (cbrt -0.5) (cbrt 2.0)) (cbrt (/ g a)))))
(if (<= g -1.34e+154)
t_1
(if (<= g -2.15e-138)
(+
(*
(cbrt 0.5)
(* (cbrt (/ 1.0 a)) (cbrt (- (sqrt (* (- g h) (+ h g))) g))))
(cbrt (* (+ g t_0) (/ -0.5 a))))
(if (<= g 4.3e-172)
(fma
(cbrt (/ (* g -0.5) a))
(cbrt 2.0)
(cbrt (* (/ (pow h 2.0) g) (/ -0.25 a))))
(if (<= g 1.35e+154)
(+
(cbrt (* (/ 0.5 a) (- t_0 g)))
(/
(cbrt (* -0.5 (+ g (sqrt (- (pow g 2.0) (pow h 2.0))))))
(cbrt a)))
t_1))))))
double code(double g, double h, double a) {
double t_0 = sqrt(((g * g) - (h * h)));
double t_1 = (cbrt(-0.5) * cbrt(2.0)) * cbrt((g / a));
double tmp;
if (g <= -1.34e+154) {
tmp = t_1;
} else if (g <= -2.15e-138) {
tmp = (cbrt(0.5) * (cbrt((1.0 / a)) * cbrt((sqrt(((g - h) * (h + g))) - g)))) + cbrt(((g + t_0) * (-0.5 / a)));
} else if (g <= 4.3e-172) {
tmp = fma(cbrt(((g * -0.5) / a)), cbrt(2.0), cbrt(((pow(h, 2.0) / g) * (-0.25 / a))));
} else if (g <= 1.35e+154) {
tmp = cbrt(((0.5 / a) * (t_0 - g))) + (cbrt((-0.5 * (g + sqrt((pow(g, 2.0) - pow(h, 2.0)))))) / cbrt(a));
} else {
tmp = t_1;
}
return tmp;
}
function code(g, h, a) t_0 = sqrt(Float64(Float64(g * g) - Float64(h * h))) t_1 = Float64(Float64(cbrt(-0.5) * cbrt(2.0)) * cbrt(Float64(g / a))) tmp = 0.0 if (g <= -1.34e+154) tmp = t_1; elseif (g <= -2.15e-138) tmp = Float64(Float64(cbrt(0.5) * Float64(cbrt(Float64(1.0 / a)) * cbrt(Float64(sqrt(Float64(Float64(g - h) * Float64(h + g))) - g)))) + cbrt(Float64(Float64(g + t_0) * Float64(-0.5 / a)))); elseif (g <= 4.3e-172) tmp = fma(cbrt(Float64(Float64(g * -0.5) / a)), cbrt(2.0), cbrt(Float64(Float64((h ^ 2.0) / g) * Float64(-0.25 / a)))); elseif (g <= 1.35e+154) tmp = Float64(cbrt(Float64(Float64(0.5 / a) * Float64(t_0 - g))) + Float64(cbrt(Float64(-0.5 * Float64(g + sqrt(Float64((g ^ 2.0) - (h ^ 2.0)))))) / cbrt(a))); else tmp = t_1; end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[g, -1.34e+154], t$95$1, If[LessEqual[g, -2.15e-138], N[(N[(N[Power[0.5, 1/3], $MachinePrecision] * N[(N[Power[N[(1.0 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(N[Sqrt[N[(N[(g - h), $MachinePrecision] * N[(h + g), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(g + t$95$0), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, 4.3e-172], N[(N[Power[N[(N[(g * -0.5), $MachinePrecision] / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision] + N[Power[N[(N[(N[Power[h, 2.0], $MachinePrecision] / g), $MachinePrecision] * N[(-0.25 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, 1.35e+154], N[(N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(t$95$0 - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[N[(-0.5 * N[(g + N[Sqrt[N[(N[Power[g, 2.0], $MachinePrecision] - N[Power[h, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{g \cdot g - h \cdot h}\\
t_1 := \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right) \cdot \sqrt[3]{\frac{g}{a}}\\
\mathbf{if}\;g \leq -1.34 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;g \leq -2.15 \cdot 10^{-138}:\\
\;\;\;\;\sqrt[3]{0.5} \cdot \left(\sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g}\right) + \sqrt[3]{\left(g + t\_0\right) \cdot \frac{-0.5}{a}}\\
\mathbf{elif}\;g \leq 4.3 \cdot 10^{-172}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{\frac{g \cdot -0.5}{a}}, \sqrt[3]{2}, \sqrt[3]{\frac{{h}^{2}}{g} \cdot \frac{-0.25}{a}}\right)\\
\mathbf{elif}\;g \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\sqrt[3]{\frac{0.5}{a} \cdot \left(t\_0 - g\right)} + \frac{\sqrt[3]{-0.5 \cdot \left(g + \sqrt{{g}^{2} - {h}^{2}}\right)}}{\sqrt[3]{a}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if g < -1.34000000000000001e154 or 1.35000000000000003e154 < g Initial program 0.0%
Simplified0.0%
Taylor expanded in h around 0 46.8%
fma-define46.8%
*-commutative46.8%
*-commutative46.8%
Simplified46.8%
Taylor expanded in g around inf 54.1%
*-commutative54.1%
Simplified54.1%
if -1.34000000000000001e154 < g < -2.15e-138Initial program 85.3%
Simplified85.3%
pow1/285.3%
difference-of-squares85.3%
unpow-prod-down0.0%
Applied egg-rr0.0%
unpow1/20.0%
unpow1/20.0%
+-commutative0.0%
Simplified0.0%
Taylor expanded in a around 0 85.3%
+-commutative85.3%
Simplified85.3%
pow1/336.8%
div-inv36.8%
unpow-prod-down39.4%
pow1/339.3%
Applied egg-rr39.3%
unpow1/398.0%
*-commutative98.0%
+-commutative98.0%
Simplified98.0%
if -2.15e-138 < g < 4.2999999999999997e-172Initial program 18.6%
Simplified18.6%
Taylor expanded in h around 0 31.9%
add-cube-cbrt31.4%
pow331.5%
Applied egg-rr31.5%
rem-cube-cbrt31.9%
associate-*r*31.9%
fma-define31.9%
cbrt-unprod31.9%
rem-3cbrt-lft31.9%
cbrt-unprod31.9%
cbrt-prod31.9%
Applied egg-rr31.9%
associate-*l/31.9%
associate-*l/31.9%
times-frac68.1%
Simplified68.1%
if 4.2999999999999997e-172 < g < 1.35000000000000003e154Initial program 80.1%
Simplified80.1%
associate-*r/80.1%
cbrt-div95.5%
pow295.5%
pow295.5%
Applied egg-rr95.5%
Final simplification77.4%
(FPCore (g h a)
:precision binary64
(if (or (<= g -1.34e+154) (not (<= g -1.1e-141)))
(* (* (cbrt -0.5) (cbrt 2.0)) (cbrt (/ g a)))
(+
(* (cbrt 0.5) (* (cbrt (/ 1.0 a)) (cbrt (- (sqrt (* (- g h) (+ h g))) g))))
(cbrt (* (+ g (sqrt (- (* g g) (* h h)))) (/ -0.5 a))))))
double code(double g, double h, double a) {
double tmp;
if ((g <= -1.34e+154) || !(g <= -1.1e-141)) {
tmp = (cbrt(-0.5) * cbrt(2.0)) * cbrt((g / a));
} else {
tmp = (cbrt(0.5) * (cbrt((1.0 / a)) * cbrt((sqrt(((g - h) * (h + g))) - g)))) + cbrt(((g + sqrt(((g * g) - (h * h)))) * (-0.5 / a)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((g <= -1.34e+154) || !(g <= -1.1e-141)) {
tmp = (Math.cbrt(-0.5) * Math.cbrt(2.0)) * Math.cbrt((g / a));
} else {
tmp = (Math.cbrt(0.5) * (Math.cbrt((1.0 / a)) * Math.cbrt((Math.sqrt(((g - h) * (h + g))) - g)))) + Math.cbrt(((g + Math.sqrt(((g * g) - (h * h)))) * (-0.5 / a)));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((g <= -1.34e+154) || !(g <= -1.1e-141)) tmp = Float64(Float64(cbrt(-0.5) * cbrt(2.0)) * cbrt(Float64(g / a))); else tmp = Float64(Float64(cbrt(0.5) * Float64(cbrt(Float64(1.0 / a)) * cbrt(Float64(sqrt(Float64(Float64(g - h) * Float64(h + g))) - g)))) + cbrt(Float64(Float64(g + sqrt(Float64(Float64(g * g) - Float64(h * h)))) * Float64(-0.5 / a)))); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[g, -1.34e+154], N[Not[LessEqual[g, -1.1e-141]], $MachinePrecision]], N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[0.5, 1/3], $MachinePrecision] * N[(N[Power[N[(1.0 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(N[Sqrt[N[(N[(g - h), $MachinePrecision] * N[(h + g), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(g + N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq -1.34 \cdot 10^{+154} \lor \neg \left(g \leq -1.1 \cdot 10^{-141}\right):\\
\;\;\;\;\left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right) \cdot \sqrt[3]{\frac{g}{a}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{0.5} \cdot \left(\sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g}\right) + \sqrt[3]{\left(g + \sqrt{g \cdot g - h \cdot h}\right) \cdot \frac{-0.5}{a}}\\
\end{array}
\end{array}
if g < -1.34000000000000001e154 or -1.10000000000000005e-141 < g Initial program 31.1%
Simplified31.1%
Taylor expanded in h around 0 54.9%
fma-define54.9%
*-commutative54.9%
*-commutative54.9%
Simplified54.9%
Taylor expanded in g around inf 65.0%
*-commutative65.0%
Simplified65.0%
if -1.34000000000000001e154 < g < -1.10000000000000005e-141Initial program 85.3%
Simplified85.3%
pow1/285.3%
difference-of-squares85.3%
unpow-prod-down0.0%
Applied egg-rr0.0%
unpow1/20.0%
unpow1/20.0%
+-commutative0.0%
Simplified0.0%
Taylor expanded in a around 0 85.3%
+-commutative85.3%
Simplified85.3%
pow1/336.8%
div-inv36.8%
unpow-prod-down39.4%
pow1/339.3%
Applied egg-rr39.3%
unpow1/398.0%
*-commutative98.0%
+-commutative98.0%
Simplified98.0%
Final simplification73.1%
(FPCore (g h a)
:precision binary64
(if (or (<= g -1.34e+154) (not (<= g -1.1e-141)))
(* (* (cbrt -0.5) (cbrt 2.0)) (cbrt (/ g a)))
(+
(cbrt (* (+ g (sqrt (- (* g g) (* h h)))) (/ -0.5 a)))
(* (cbrt (/ 0.5 a)) (cbrt (- (sqrt (* (- g h) (+ h g))) g))))))
double code(double g, double h, double a) {
double tmp;
if ((g <= -1.34e+154) || !(g <= -1.1e-141)) {
tmp = (cbrt(-0.5) * cbrt(2.0)) * cbrt((g / a));
} else {
tmp = cbrt(((g + sqrt(((g * g) - (h * h)))) * (-0.5 / a))) + (cbrt((0.5 / a)) * cbrt((sqrt(((g - h) * (h + g))) - g)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((g <= -1.34e+154) || !(g <= -1.1e-141)) {
tmp = (Math.cbrt(-0.5) * Math.cbrt(2.0)) * Math.cbrt((g / a));
} else {
tmp = Math.cbrt(((g + Math.sqrt(((g * g) - (h * h)))) * (-0.5 / a))) + (Math.cbrt((0.5 / a)) * Math.cbrt((Math.sqrt(((g - h) * (h + g))) - g)));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((g <= -1.34e+154) || !(g <= -1.1e-141)) tmp = Float64(Float64(cbrt(-0.5) * cbrt(2.0)) * cbrt(Float64(g / a))); else tmp = Float64(cbrt(Float64(Float64(g + sqrt(Float64(Float64(g * g) - Float64(h * h)))) * Float64(-0.5 / a))) + Float64(cbrt(Float64(0.5 / a)) * cbrt(Float64(sqrt(Float64(Float64(g - h) * Float64(h + g))) - g)))); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[g, -1.34e+154], N[Not[LessEqual[g, -1.1e-141]], $MachinePrecision]], N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(g + N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(N[Sqrt[N[(N[(g - h), $MachinePrecision] * N[(h + g), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq -1.34 \cdot 10^{+154} \lor \neg \left(g \leq -1.1 \cdot 10^{-141}\right):\\
\;\;\;\;\left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right) \cdot \sqrt[3]{\frac{g}{a}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\left(g + \sqrt{g \cdot g - h \cdot h}\right) \cdot \frac{-0.5}{a}} + \sqrt[3]{\frac{0.5}{a}} \cdot \sqrt[3]{\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g}\\
\end{array}
\end{array}
if g < -1.34000000000000001e154 or -1.10000000000000005e-141 < g Initial program 31.1%
Simplified31.1%
Taylor expanded in h around 0 54.9%
fma-define54.9%
*-commutative54.9%
*-commutative54.9%
Simplified54.9%
Taylor expanded in g around inf 65.0%
*-commutative65.0%
Simplified65.0%
if -1.34000000000000001e154 < g < -1.10000000000000005e-141Initial program 85.3%
Simplified85.3%
pow1/285.3%
difference-of-squares85.3%
unpow-prod-down0.0%
Applied egg-rr0.0%
unpow1/20.0%
unpow1/20.0%
+-commutative0.0%
Simplified0.0%
cbrt-prod0.0%
sqrt-unprod97.9%
+-commutative97.9%
Applied egg-rr97.9%
+-commutative97.9%
Simplified97.9%
Final simplification73.1%
(FPCore (g h a)
:precision binary64
(if (or (<= g -1.34e+154) (not (<= g -1.1e-141)))
(* (* (cbrt -0.5) (cbrt 2.0)) (cbrt (/ g a)))
(+
(/ (cbrt (* 0.5 (- (sqrt (* (- g h) (+ h g))) g))) (cbrt a))
(cbrt (* (/ -0.5 a) (- g g))))))
double code(double g, double h, double a) {
double tmp;
if ((g <= -1.34e+154) || !(g <= -1.1e-141)) {
tmp = (cbrt(-0.5) * cbrt(2.0)) * cbrt((g / a));
} else {
tmp = (cbrt((0.5 * (sqrt(((g - h) * (h + g))) - g))) / cbrt(a)) + cbrt(((-0.5 / a) * (g - g)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((g <= -1.34e+154) || !(g <= -1.1e-141)) {
tmp = (Math.cbrt(-0.5) * Math.cbrt(2.0)) * Math.cbrt((g / a));
} else {
tmp = (Math.cbrt((0.5 * (Math.sqrt(((g - h) * (h + g))) - g))) / Math.cbrt(a)) + Math.cbrt(((-0.5 / a) * (g - g)));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((g <= -1.34e+154) || !(g <= -1.1e-141)) tmp = Float64(Float64(cbrt(-0.5) * cbrt(2.0)) * cbrt(Float64(g / a))); else tmp = Float64(Float64(cbrt(Float64(0.5 * Float64(sqrt(Float64(Float64(g - h) * Float64(h + g))) - g))) / cbrt(a)) + cbrt(Float64(Float64(-0.5 / a) * Float64(g - g)))); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[g, -1.34e+154], N[Not[LessEqual[g, -1.1e-141]], $MachinePrecision]], N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(0.5 * N[(N[Sqrt[N[(N[(g - h), $MachinePrecision] * N[(h + g), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq -1.34 \cdot 10^{+154} \lor \neg \left(g \leq -1.1 \cdot 10^{-141}\right):\\
\;\;\;\;\left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right) \cdot \sqrt[3]{\frac{g}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g\right)}}{\sqrt[3]{a}} + \sqrt[3]{\frac{-0.5}{a} \cdot \left(g - g\right)}\\
\end{array}
\end{array}
if g < -1.34000000000000001e154 or -1.10000000000000005e-141 < g Initial program 31.1%
Simplified31.1%
Taylor expanded in h around 0 54.9%
fma-define54.9%
*-commutative54.9%
*-commutative54.9%
Simplified54.9%
Taylor expanded in g around inf 65.0%
*-commutative65.0%
Simplified65.0%
if -1.34000000000000001e154 < g < -1.10000000000000005e-141Initial program 85.3%
Simplified85.3%
pow1/285.3%
difference-of-squares85.3%
unpow-prod-down0.0%
Applied egg-rr0.0%
unpow1/20.0%
unpow1/20.0%
+-commutative0.0%
Simplified0.0%
associate-*l/0.0%
cbrt-div0.0%
sqrt-unprod97.8%
+-commutative97.8%
Applied egg-rr97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in g around -inf 95.1%
neg-mul-195.1%
Simplified95.1%
Final simplification72.4%
(FPCore (g h a) :precision binary64 (* (* (cbrt -0.5) (cbrt 2.0)) (cbrt (/ g a))))
double code(double g, double h, double a) {
return (cbrt(-0.5) * cbrt(2.0)) * cbrt((g / a));
}
public static double code(double g, double h, double a) {
return (Math.cbrt(-0.5) * Math.cbrt(2.0)) * Math.cbrt((g / a));
}
function code(g, h, a) return Float64(Float64(cbrt(-0.5) * cbrt(2.0)) * cbrt(Float64(g / a))) end
code[g_, h_, a_] := N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right) \cdot \sqrt[3]{\frac{g}{a}}
\end{array}
Initial program 44.4%
Simplified44.4%
Taylor expanded in h around 0 61.9%
fma-define61.9%
*-commutative61.9%
*-commutative61.9%
Simplified61.9%
Taylor expanded in g around inf 69.1%
*-commutative69.1%
Simplified69.1%
herbie shell --seed 2024111
(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))))))))