
(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 14 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 (+ (* (* (cbrt g) (cbrt (/ 1.0 a))) (* (cbrt -0.5) (cbrt 2.0))) (* (/ (pow (cbrt h) 2.0) (* (cbrt g) (cbrt a))) (* (cbrt -0.5) (cbrt 0.5)))))
double code(double g, double h, double a) {
return ((cbrt(g) * cbrt((1.0 / a))) * (cbrt(-0.5) * cbrt(2.0))) + ((pow(cbrt(h), 2.0) / (cbrt(g) * cbrt(a))) * (cbrt(-0.5) * cbrt(0.5)));
}
public static double code(double g, double h, double a) {
return ((Math.cbrt(g) * Math.cbrt((1.0 / a))) * (Math.cbrt(-0.5) * Math.cbrt(2.0))) + ((Math.pow(Math.cbrt(h), 2.0) / (Math.cbrt(g) * Math.cbrt(a))) * (Math.cbrt(-0.5) * Math.cbrt(0.5)));
}
function code(g, h, a) return Float64(Float64(Float64(cbrt(g) * cbrt(Float64(1.0 / a))) * Float64(cbrt(-0.5) * cbrt(2.0))) + Float64(Float64((cbrt(h) ^ 2.0) / Float64(cbrt(g) * cbrt(a))) * Float64(cbrt(-0.5) * cbrt(0.5)))) end
code[g_, h_, a_] := N[(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] + N[(N[(N[Power[N[Power[h, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[0.5, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\sqrt[3]{g} \cdot \sqrt[3]{\frac{1}{a}}\right) \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right) + \frac{{\left(\sqrt[3]{h}\right)}^{2}}{\sqrt[3]{g} \cdot \sqrt[3]{a}} \cdot \left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right)
\end{array}
Initial program 42.7%
Simplified42.7%
Taylor expanded in h around 0 66.4%
pow1/333.8%
div-inv33.8%
unpow-prod-down22.4%
pow1/343.6%
Applied egg-rr43.6%
unpow1/386.8%
Simplified86.8%
pow286.8%
cbrt-div87.7%
cbrt-prod93.7%
pow293.7%
Applied egg-rr93.7%
*-commutative93.7%
cbrt-prod97.7%
Applied egg-rr97.7%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (cbrt -0.5) (cbrt 0.5))) (t_1 (sqrt (- (* g g) (* h h)))))
(if (<=
(+
(cbrt (* (/ 1.0 (* a 2.0)) (- t_1 g)))
(cbrt (* (+ g t_1) (/ -1.0 (* a 2.0)))))
2e+95)
(+
(* (* (cbrt -0.5) (cbrt 2.0)) (/ (cbrt g) (cbrt a)))
(* t_0 (/ 1.0 (cbrt (* a (/ g (pow h 2.0)))))))
(+
(*
(* (cbrt g) (cbrt (/ 1.0 a)))
(* (cbrt -0.5) (pow 2.0 0.3333333333333333)))
(* t_0 (/ (pow (cbrt h) 2.0) (cbrt (* g a))))))))
double code(double g, double h, double a) {
double t_0 = cbrt(-0.5) * cbrt(0.5);
double t_1 = sqrt(((g * g) - (h * h)));
double tmp;
if ((cbrt(((1.0 / (a * 2.0)) * (t_1 - g))) + cbrt(((g + t_1) * (-1.0 / (a * 2.0))))) <= 2e+95) {
tmp = ((cbrt(-0.5) * cbrt(2.0)) * (cbrt(g) / cbrt(a))) + (t_0 * (1.0 / cbrt((a * (g / pow(h, 2.0))))));
} else {
tmp = ((cbrt(g) * cbrt((1.0 / a))) * (cbrt(-0.5) * pow(2.0, 0.3333333333333333))) + (t_0 * (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(-0.5) * Math.cbrt(0.5);
double t_1 = Math.sqrt(((g * g) - (h * h)));
double tmp;
if ((Math.cbrt(((1.0 / (a * 2.0)) * (t_1 - g))) + Math.cbrt(((g + t_1) * (-1.0 / (a * 2.0))))) <= 2e+95) {
tmp = ((Math.cbrt(-0.5) * Math.cbrt(2.0)) * (Math.cbrt(g) / Math.cbrt(a))) + (t_0 * (1.0 / Math.cbrt((a * (g / Math.pow(h, 2.0))))));
} else {
tmp = ((Math.cbrt(g) * Math.cbrt((1.0 / a))) * (Math.cbrt(-0.5) * Math.pow(2.0, 0.3333333333333333))) + (t_0 * (Math.pow(Math.cbrt(h), 2.0) / Math.cbrt((g * a))));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(cbrt(-0.5) * cbrt(0.5)) t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h))) tmp = 0.0 if (Float64(cbrt(Float64(Float64(1.0 / Float64(a * 2.0)) * Float64(t_1 - g))) + cbrt(Float64(Float64(g + t_1) * Float64(-1.0 / Float64(a * 2.0))))) <= 2e+95) tmp = Float64(Float64(Float64(cbrt(-0.5) * cbrt(2.0)) * Float64(cbrt(g) / cbrt(a))) + Float64(t_0 * Float64(1.0 / cbrt(Float64(a * Float64(g / (h ^ 2.0))))))); else tmp = Float64(Float64(Float64(cbrt(g) * cbrt(Float64(1.0 / a))) * Float64(cbrt(-0.5) * (2.0 ^ 0.3333333333333333))) + Float64(t_0 * Float64((cbrt(h) ^ 2.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[0.5, 1/3], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(g + t$95$1), $MachinePrecision] * N[(-1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 2e+95], N[(N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(1.0 / N[Power[N[(a * N[(g / N[Power[h, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(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, 0.3333333333333333], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * 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 := \sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
\mathbf{if}\;\sqrt[3]{\frac{1}{a \cdot 2} \cdot \left(t\_1 - g\right)} + \sqrt[3]{\left(g + t\_1\right) \cdot \frac{-1}{a \cdot 2}} \leq 2 \cdot 10^{+95}:\\
\;\;\;\;\left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right) \cdot \frac{\sqrt[3]{g}}{\sqrt[3]{a}} + t\_0 \cdot \frac{1}{\sqrt[3]{a \cdot \frac{g}{{h}^{2}}}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{g} \cdot \sqrt[3]{\frac{1}{a}}\right) \cdot \left(\sqrt[3]{-0.5} \cdot {2}^{0.3333333333333333}\right) + t\_0 \cdot \frac{{\left(\sqrt[3]{h}\right)}^{2}}{\sqrt[3]{g \cdot a}}\\
\end{array}
\end{array}
if (+.f64 (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) < 2.00000000000000004e95Initial program 82.6%
Simplified82.6%
Taylor expanded in h around 0 80.2%
cbrt-div89.0%
Applied egg-rr89.0%
pow289.0%
clear-num89.0%
cbrt-div89.0%
metadata-eval89.0%
pow289.0%
Applied egg-rr89.0%
associate-/l*95.9%
Simplified95.9%
if 2.00000000000000004e95 < (+.f64 (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) Initial program 0.2%
Simplified0.2%
Taylor expanded in h around 0 51.7%
pow1/326.4%
div-inv26.4%
unpow-prod-down21.7%
pow1/346.9%
Applied egg-rr46.9%
unpow1/384.3%
Simplified84.3%
pow284.3%
cbrt-div85.8%
cbrt-prod97.3%
pow297.3%
Applied egg-rr97.3%
pow1/398.0%
Applied egg-rr98.0%
Final simplification96.9%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (sqrt (- (* g g) (* h h))))
(t_1 (+ g t_0))
(t_2
(+
(cbrt (* (/ 1.0 (* a 2.0)) (- t_0 g)))
(cbrt (* t_1 (/ -1.0 (* a 2.0)))))))
(if (<= t_2 -5e-94)
(- (cbrt (* (/ (pow h 2.0) g) (/ -0.25 a))) (cbrt (/ g a)))
(if (<= t_2 2e-104)
(+ (/ (cbrt (- g)) (cbrt a)) (cbrt (* t_1 (/ -0.5 a))))
(+ (cbrt (/ (- g) a)) (cbrt (* (/ -0.5 a) (- g g))))))))
double code(double g, double h, double a) {
double t_0 = sqrt(((g * g) - (h * h)));
double t_1 = g + t_0;
double t_2 = cbrt(((1.0 / (a * 2.0)) * (t_0 - g))) + cbrt((t_1 * (-1.0 / (a * 2.0))));
double tmp;
if (t_2 <= -5e-94) {
tmp = cbrt(((pow(h, 2.0) / g) * (-0.25 / a))) - cbrt((g / a));
} else if (t_2 <= 2e-104) {
tmp = (cbrt(-g) / cbrt(a)) + cbrt((t_1 * (-0.5 / a)));
} else {
tmp = cbrt((-g / a)) + cbrt(((-0.5 / a) * (g - g)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.sqrt(((g * g) - (h * h)));
double t_1 = g + t_0;
double t_2 = Math.cbrt(((1.0 / (a * 2.0)) * (t_0 - g))) + Math.cbrt((t_1 * (-1.0 / (a * 2.0))));
double tmp;
if (t_2 <= -5e-94) {
tmp = Math.cbrt(((Math.pow(h, 2.0) / g) * (-0.25 / a))) - Math.cbrt((g / a));
} else if (t_2 <= 2e-104) {
tmp = (Math.cbrt(-g) / Math.cbrt(a)) + Math.cbrt((t_1 * (-0.5 / a)));
} else {
tmp = Math.cbrt((-g / a)) + Math.cbrt(((-0.5 / a) * (g - g)));
}
return tmp;
}
function code(g, h, a) t_0 = sqrt(Float64(Float64(g * g) - Float64(h * h))) t_1 = Float64(g + t_0) t_2 = Float64(cbrt(Float64(Float64(1.0 / Float64(a * 2.0)) * Float64(t_0 - g))) + cbrt(Float64(t_1 * Float64(-1.0 / Float64(a * 2.0))))) tmp = 0.0 if (t_2 <= -5e-94) tmp = Float64(cbrt(Float64(Float64((h ^ 2.0) / g) * Float64(-0.25 / a))) - cbrt(Float64(g / a))); elseif (t_2 <= 2e-104) tmp = Float64(Float64(cbrt(Float64(-g)) / cbrt(a)) + cbrt(Float64(t_1 * Float64(-0.5 / a)))); else tmp = Float64(cbrt(Float64(Float64(-g) / a)) + cbrt(Float64(Float64(-0.5 / a) * Float64(g - g)))); 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[(g + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(N[(1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(t$95$1 * N[(-1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-94], N[(N[Power[N[(N[(N[Power[h, 2.0], $MachinePrecision] / g), $MachinePrecision] * N[(-0.25 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e-104], N[(N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[(t$95$1 * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{g \cdot g - h \cdot h}\\
t_1 := g + t\_0\\
t_2 := \sqrt[3]{\frac{1}{a \cdot 2} \cdot \left(t\_0 - g\right)} + \sqrt[3]{t\_1 \cdot \frac{-1}{a \cdot 2}}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-94}:\\
\;\;\;\;\sqrt[3]{\frac{{h}^{2}}{g} \cdot \frac{-0.25}{a}} - \sqrt[3]{\frac{g}{a}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-104}:\\
\;\;\;\;\frac{\sqrt[3]{-g}}{\sqrt[3]{a}} + \sqrt[3]{t\_1 \cdot \frac{-0.5}{a}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{-g}{a}} + \sqrt[3]{\frac{-0.5}{a} \cdot \left(g - g\right)}\\
\end{array}
\end{array}
if (+.f64 (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) < -4.9999999999999995e-94Initial program 85.5%
Simplified85.5%
Taylor expanded in h around 0 84.5%
add-cube-cbrt83.9%
pow383.9%
Applied egg-rr83.8%
Applied egg-rr83.8%
unpow283.8%
rem-3cbrt-rft85.1%
fma-undefine85.1%
*-commutative85.1%
+-commutative85.1%
mul-1-neg85.1%
unsub-neg85.1%
associate-*l/85.1%
*-commutative85.1%
times-frac93.9%
Simplified93.9%
if -4.9999999999999995e-94 < (+.f64 (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) < 1.99999999999999985e-104Initial program 11.0%
Simplified11.0%
Taylor expanded in g around -inf 11.0%
associate-*r/11.0%
neg-mul-111.0%
Simplified11.0%
cbrt-div85.2%
Applied egg-rr85.2%
if 1.99999999999999985e-104 < (+.f64 (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) Initial program 28.7%
Simplified28.7%
Taylor expanded in g around -inf 15.8%
associate-*r/15.8%
neg-mul-115.8%
Simplified15.8%
Taylor expanded in g around -inf 71.0%
neg-mul-171.0%
Simplified71.0%
Final simplification77.7%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (cbrt -0.5) (cbrt 0.5))) (t_1 (sqrt (- (* g g) (* h h)))))
(if (<=
(+
(cbrt (* (/ 1.0 (* a 2.0)) (- t_1 g)))
(cbrt (* (+ g t_1) (/ -1.0 (* a 2.0)))))
2e+95)
(+
(* (* (cbrt -0.5) (cbrt 2.0)) (/ (cbrt g) (cbrt a)))
(* t_0 (/ 1.0 (cbrt (* a (/ g (pow h 2.0)))))))
(+
(* t_0 (/ (pow (cbrt h) 2.0) (cbrt (* g a))))
(/ (cbrt (- g)) (cbrt a))))))
double code(double g, double h, double a) {
double t_0 = cbrt(-0.5) * cbrt(0.5);
double t_1 = sqrt(((g * g) - (h * h)));
double tmp;
if ((cbrt(((1.0 / (a * 2.0)) * (t_1 - g))) + cbrt(((g + t_1) * (-1.0 / (a * 2.0))))) <= 2e+95) {
tmp = ((cbrt(-0.5) * cbrt(2.0)) * (cbrt(g) / cbrt(a))) + (t_0 * (1.0 / cbrt((a * (g / pow(h, 2.0))))));
} else {
tmp = (t_0 * (pow(cbrt(h), 2.0) / cbrt((g * a)))) + (cbrt(-g) / cbrt(a));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.cbrt(-0.5) * Math.cbrt(0.5);
double t_1 = Math.sqrt(((g * g) - (h * h)));
double tmp;
if ((Math.cbrt(((1.0 / (a * 2.0)) * (t_1 - g))) + Math.cbrt(((g + t_1) * (-1.0 / (a * 2.0))))) <= 2e+95) {
tmp = ((Math.cbrt(-0.5) * Math.cbrt(2.0)) * (Math.cbrt(g) / Math.cbrt(a))) + (t_0 * (1.0 / Math.cbrt((a * (g / Math.pow(h, 2.0))))));
} else {
tmp = (t_0 * (Math.pow(Math.cbrt(h), 2.0) / Math.cbrt((g * a)))) + (Math.cbrt(-g) / Math.cbrt(a));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(cbrt(-0.5) * cbrt(0.5)) t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h))) tmp = 0.0 if (Float64(cbrt(Float64(Float64(1.0 / Float64(a * 2.0)) * Float64(t_1 - g))) + cbrt(Float64(Float64(g + t_1) * Float64(-1.0 / Float64(a * 2.0))))) <= 2e+95) tmp = Float64(Float64(Float64(cbrt(-0.5) * cbrt(2.0)) * Float64(cbrt(g) / cbrt(a))) + Float64(t_0 * Float64(1.0 / cbrt(Float64(a * Float64(g / (h ^ 2.0))))))); else tmp = Float64(Float64(t_0 * Float64((cbrt(h) ^ 2.0) / cbrt(Float64(g * a)))) + Float64(cbrt(Float64(-g)) / cbrt(a))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[0.5, 1/3], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(g + t$95$1), $MachinePrecision] * N[(-1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 2e+95], N[(N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(1.0 / N[Power[N[(a * N[(g / N[Power[h, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * 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[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
\mathbf{if}\;\sqrt[3]{\frac{1}{a \cdot 2} \cdot \left(t\_1 - g\right)} + \sqrt[3]{\left(g + t\_1\right) \cdot \frac{-1}{a \cdot 2}} \leq 2 \cdot 10^{+95}:\\
\;\;\;\;\left(\sqrt[3]{-0.5} \cdot \sqrt[3]{2}\right) \cdot \frac{\sqrt[3]{g}}{\sqrt[3]{a}} + t\_0 \cdot \frac{1}{\sqrt[3]{a \cdot \frac{g}{{h}^{2}}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{{\left(\sqrt[3]{h}\right)}^{2}}{\sqrt[3]{g \cdot a}} + \frac{\sqrt[3]{-g}}{\sqrt[3]{a}}\\
\end{array}
\end{array}
if (+.f64 (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) < 2.00000000000000004e95Initial program 82.6%
Simplified82.6%
Taylor expanded in h around 0 80.2%
cbrt-div89.0%
Applied egg-rr89.0%
pow289.0%
clear-num89.0%
cbrt-div89.0%
metadata-eval89.0%
pow289.0%
Applied egg-rr89.0%
associate-/l*95.9%
Simplified95.9%
if 2.00000000000000004e95 < (+.f64 (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 #s(literal 2 binary64) a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) Initial program 0.2%
Simplified0.2%
Taylor expanded in h around 0 51.7%
pow1/326.4%
div-inv26.4%
unpow-prod-down21.7%
pow1/346.9%
Applied egg-rr46.9%
unpow1/384.3%
Simplified84.3%
pow284.3%
cbrt-div85.8%
cbrt-prod97.3%
pow297.3%
Applied egg-rr97.3%
cbrt-div97.2%
metadata-eval97.2%
div-inv97.1%
associate-*l/97.1%
cbrt-unprod97.9%
metadata-eval97.9%
cbrt-unprod97.9%
Applied egg-rr97.9%
Final simplification96.9%
(FPCore (g h a) :precision binary64 (+ (* (* (cbrt -0.5) (cbrt 0.5)) (/ (pow (cbrt h) 2.0) (cbrt (* g a)))) (/ (cbrt (- g)) (cbrt a))))
double code(double g, double h, double a) {
return ((cbrt(-0.5) * cbrt(0.5)) * (pow(cbrt(h), 2.0) / cbrt((g * a)))) + (cbrt(-g) / cbrt(a));
}
public static double code(double g, double h, double a) {
return ((Math.cbrt(-0.5) * Math.cbrt(0.5)) * (Math.pow(Math.cbrt(h), 2.0) / Math.cbrt((g * a)))) + (Math.cbrt(-g) / Math.cbrt(a));
}
function code(g, h, a) return Float64(Float64(Float64(cbrt(-0.5) * cbrt(0.5)) * Float64((cbrt(h) ^ 2.0) / cbrt(Float64(g * a)))) + Float64(cbrt(Float64(-g)) / cbrt(a))) end
code[g_, h_, a_] := 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[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right) \cdot \frac{{\left(\sqrt[3]{h}\right)}^{2}}{\sqrt[3]{g \cdot a}} + \frac{\sqrt[3]{-g}}{\sqrt[3]{a}}
\end{array}
Initial program 42.7%
Simplified42.7%
Taylor expanded in h around 0 66.4%
pow1/333.8%
div-inv33.8%
unpow-prod-down22.4%
pow1/343.6%
Applied egg-rr43.6%
unpow1/386.8%
Simplified86.8%
pow286.8%
cbrt-div87.7%
cbrt-prod93.7%
pow293.7%
Applied egg-rr93.7%
cbrt-div93.6%
metadata-eval93.6%
div-inv93.6%
associate-*l/93.5%
cbrt-unprod94.2%
metadata-eval94.2%
cbrt-unprod94.2%
Applied egg-rr94.2%
Final simplification94.2%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (* (cbrt -0.5) (cbrt 0.5))))
(if (<= (* h h) 5e+283)
(+ (* t_0 (cbrt (/ (pow h 2.0) (* g a)))) (/ (cbrt (- g)) (cbrt a)))
(*
h
(+
(* t_0 (cbrt (/ 1.0 (* a (* g h)))))
(* (/ 1.0 (cbrt (/ a g))) (/ (* (cbrt -0.5) (cbrt 2.0)) h)))))))
double code(double g, double h, double a) {
double t_0 = cbrt(-0.5) * cbrt(0.5);
double tmp;
if ((h * h) <= 5e+283) {
tmp = (t_0 * cbrt((pow(h, 2.0) / (g * a)))) + (cbrt(-g) / cbrt(a));
} else {
tmp = h * ((t_0 * cbrt((1.0 / (a * (g * h))))) + ((1.0 / cbrt((a / g))) * ((cbrt(-0.5) * cbrt(2.0)) / h)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.cbrt(-0.5) * Math.cbrt(0.5);
double tmp;
if ((h * h) <= 5e+283) {
tmp = (t_0 * Math.cbrt((Math.pow(h, 2.0) / (g * a)))) + (Math.cbrt(-g) / Math.cbrt(a));
} else {
tmp = h * ((t_0 * Math.cbrt((1.0 / (a * (g * h))))) + ((1.0 / Math.cbrt((a / g))) * ((Math.cbrt(-0.5) * Math.cbrt(2.0)) / h)));
}
return tmp;
}
function code(g, h, a) t_0 = Float64(cbrt(-0.5) * cbrt(0.5)) tmp = 0.0 if (Float64(h * h) <= 5e+283) tmp = Float64(Float64(t_0 * cbrt(Float64((h ^ 2.0) / Float64(g * a)))) + Float64(cbrt(Float64(-g)) / cbrt(a))); else tmp = Float64(h * Float64(Float64(t_0 * cbrt(Float64(1.0 / Float64(a * Float64(g * h))))) + Float64(Float64(1.0 / cbrt(Float64(a / g))) * Float64(Float64(cbrt(-0.5) * cbrt(2.0)) / h)))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[0.5, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h * h), $MachinePrecision], 5e+283], N[(N[(t$95$0 * N[Power[N[(N[Power[h, 2.0], $MachinePrecision] / N[(g * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(h * N[(N[(t$95$0 * N[Power[N[(1.0 / N[(a * N[(g * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[Power[N[(a / g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\\
\mathbf{if}\;h \cdot h \leq 5 \cdot 10^{+283}:\\
\;\;\;\;t\_0 \cdot \sqrt[3]{\frac{{h}^{2}}{g \cdot a}} + \frac{\sqrt[3]{-g}}{\sqrt[3]{a}}\\
\mathbf{else}:\\
\;\;\;\;h \cdot \left(t\_0 \cdot \sqrt[3]{\frac{1}{a \cdot \left(g \cdot h\right)}} + \frac{1}{\sqrt[3]{\frac{a}{g}}} \cdot \frac{\sqrt[3]{-0.5} \cdot \sqrt[3]{2}}{h}\right)\\
\end{array}
\end{array}
if (*.f64 h h) < 5.0000000000000004e283Initial program 45.9%
Simplified45.9%
Taylor expanded in h around 0 70.8%
pow1/335.9%
div-inv35.9%
unpow-prod-down23.6%
pow1/346.4%
Applied egg-rr46.4%
unpow1/392.7%
Simplified92.7%
cbrt-div93.7%
metadata-eval93.7%
div-inv93.7%
associate-*l/93.6%
cbrt-unprod94.3%
metadata-eval94.3%
cbrt-unprod94.3%
Applied egg-rr93.2%
if 5.0000000000000004e283 < (*.f64 h h) Initial program 0.2%
Simplified0.2%
Taylor expanded in h around 0 7.9%
Taylor expanded in h around inf 61.3%
clear-num61.3%
cbrt-div64.1%
metadata-eval64.1%
Applied egg-rr64.1%
Final simplification91.2%
(FPCore (g h a)
:precision binary64
(if (<= (* h h) 5e+283)
(+
(* (* (cbrt -0.5) (cbrt 0.5)) (cbrt (/ (pow h 2.0) (* g a))))
(/ (cbrt (- g)) (cbrt a)))
(cbrt
(pow
(* h (+ (/ (cbrt (/ (- g) a)) h) (cbrt (/ (* (/ 1.0 a) -0.25) (* g h)))))
3.0))))
double code(double g, double h, double a) {
double tmp;
if ((h * h) <= 5e+283) {
tmp = ((cbrt(-0.5) * cbrt(0.5)) * cbrt((pow(h, 2.0) / (g * a)))) + (cbrt(-g) / cbrt(a));
} else {
tmp = cbrt(pow((h * ((cbrt((-g / a)) / h) + cbrt((((1.0 / a) * -0.25) / (g * h))))), 3.0));
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((h * h) <= 5e+283) {
tmp = ((Math.cbrt(-0.5) * Math.cbrt(0.5)) * Math.cbrt((Math.pow(h, 2.0) / (g * a)))) + (Math.cbrt(-g) / Math.cbrt(a));
} else {
tmp = Math.cbrt(Math.pow((h * ((Math.cbrt((-g / a)) / h) + Math.cbrt((((1.0 / a) * -0.25) / (g * h))))), 3.0));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if (Float64(h * h) <= 5e+283) tmp = Float64(Float64(Float64(cbrt(-0.5) * cbrt(0.5)) * cbrt(Float64((h ^ 2.0) / Float64(g * a)))) + Float64(cbrt(Float64(-g)) / cbrt(a))); else tmp = cbrt((Float64(h * Float64(Float64(cbrt(Float64(Float64(-g) / a)) / h) + cbrt(Float64(Float64(Float64(1.0 / a) * -0.25) / Float64(g * h))))) ^ 3.0)); end return tmp end
code[g_, h_, a_] := If[LessEqual[N[(h * h), $MachinePrecision], 5e+283], N[(N[(N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[Power[0.5, 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[Power[h, 2.0], $MachinePrecision] / N[(g * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(h * N[(N[(N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision] / h), $MachinePrecision] + N[Power[N[(N[(N[(1.0 / a), $MachinePrecision] * -0.25), $MachinePrecision] / N[(g * h), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \cdot h \leq 5 \cdot 10^{+283}:\\
\;\;\;\;\left(\sqrt[3]{-0.5} \cdot \sqrt[3]{0.5}\right) \cdot \sqrt[3]{\frac{{h}^{2}}{g \cdot a}} + \frac{\sqrt[3]{-g}}{\sqrt[3]{a}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(h \cdot \left(\frac{\sqrt[3]{\frac{-g}{a}}}{h} + \sqrt[3]{\frac{\frac{1}{a} \cdot -0.25}{g \cdot h}}\right)\right)}^{3}}\\
\end{array}
\end{array}
if (*.f64 h h) < 5.0000000000000004e283Initial program 45.9%
Simplified45.9%
Taylor expanded in h around 0 70.8%
pow1/335.9%
div-inv35.9%
unpow-prod-down23.6%
pow1/346.4%
Applied egg-rr46.4%
unpow1/392.7%
Simplified92.7%
cbrt-div93.7%
metadata-eval93.7%
div-inv93.7%
associate-*l/93.6%
cbrt-unprod94.3%
metadata-eval94.3%
cbrt-unprod94.3%
Applied egg-rr93.2%
if 5.0000000000000004e283 < (*.f64 h h) Initial program 0.2%
Simplified0.2%
Taylor expanded in h around 0 7.9%
Taylor expanded in h around inf 61.3%
+-commutative61.3%
cbrt-div89.0%
add-cube-cbrt88.8%
fma-define88.8%
Applied egg-rr61.3%
add-cbrt-cube61.4%
pow361.3%
Applied egg-rr62.1%
Final simplification91.0%
(FPCore (g h a)
:precision binary64
(if (<= h 9.8e+142)
(pow
(cbrt
(+ (/ (cbrt (- g)) (cbrt a)) (cbrt (* (/ (pow h 2.0) (* g a)) -0.25))))
3.0)
(cbrt
(pow
(* h (+ (/ (cbrt (/ (- g) a)) h) (cbrt (/ (* (/ 1.0 a) -0.25) (* g h)))))
3.0))))
double code(double g, double h, double a) {
double tmp;
if (h <= 9.8e+142) {
tmp = pow(cbrt(((cbrt(-g) / cbrt(a)) + cbrt(((pow(h, 2.0) / (g * a)) * -0.25)))), 3.0);
} else {
tmp = cbrt(pow((h * ((cbrt((-g / a)) / h) + cbrt((((1.0 / a) * -0.25) / (g * h))))), 3.0));
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if (h <= 9.8e+142) {
tmp = Math.pow(Math.cbrt(((Math.cbrt(-g) / Math.cbrt(a)) + Math.cbrt(((Math.pow(h, 2.0) / (g * a)) * -0.25)))), 3.0);
} else {
tmp = Math.cbrt(Math.pow((h * ((Math.cbrt((-g / a)) / h) + Math.cbrt((((1.0 / a) * -0.25) / (g * h))))), 3.0));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if (h <= 9.8e+142) tmp = cbrt(Float64(Float64(cbrt(Float64(-g)) / cbrt(a)) + cbrt(Float64(Float64((h ^ 2.0) / Float64(g * a)) * -0.25)))) ^ 3.0; else tmp = cbrt((Float64(h * Float64(Float64(cbrt(Float64(Float64(-g) / a)) / h) + cbrt(Float64(Float64(Float64(1.0 / a) * -0.25) / Float64(g * h))))) ^ 3.0)); end return tmp end
code[g_, h_, a_] := If[LessEqual[h, 9.8e+142], N[Power[N[Power[N[(N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(N[Power[h, 2.0], $MachinePrecision] / N[(g * a), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], N[Power[N[Power[N[(h * N[(N[(N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision] / h), $MachinePrecision] + N[Power[N[(N[(N[(1.0 / a), $MachinePrecision] * -0.25), $MachinePrecision] / N[(g * h), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq 9.8 \cdot 10^{+142}:\\
\;\;\;\;{\left(\sqrt[3]{\frac{\sqrt[3]{-g}}{\sqrt[3]{a}} + \sqrt[3]{\frac{{h}^{2}}{g \cdot a} \cdot -0.25}}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(h \cdot \left(\frac{\sqrt[3]{\frac{-g}{a}}}{h} + \sqrt[3]{\frac{\frac{1}{a} \cdot -0.25}{g \cdot h}}\right)\right)}^{3}}\\
\end{array}
\end{array}
if h < 9.80000000000000101e142Initial program 44.3%
Simplified44.3%
Taylor expanded in h around 0 68.3%
add-cube-cbrt67.9%
pow367.9%
Applied egg-rr68.0%
*-commutative68.0%
associate-*r/68.0%
cbrt-div89.0%
Applied egg-rr89.0%
*-commutative89.0%
*-commutative89.0%
mul-1-neg89.0%
Simplified89.0%
if 9.80000000000000101e142 < h Initial program 0.5%
Simplified0.5%
Taylor expanded in h around 0 14.3%
Taylor expanded in h around inf 45.3%
+-commutative45.3%
cbrt-div90.6%
add-cube-cbrt90.2%
fma-define90.1%
Applied egg-rr45.1%
add-cbrt-cube45.1%
pow345.1%
Applied egg-rr45.9%
Final simplification87.4%
(FPCore (g h a)
:precision binary64
(if (<= h 9.8e+142)
(fma (cbrt g) (cbrt (/ -1.0 a)) (cbrt (* (pow h 2.0) (/ -0.25 (* g a)))))
(cbrt
(pow
(* h (+ (/ (cbrt (/ (- g) a)) h) (cbrt (/ (* (/ 1.0 a) -0.25) (* g h)))))
3.0))))
double code(double g, double h, double a) {
double tmp;
if (h <= 9.8e+142) {
tmp = fma(cbrt(g), cbrt((-1.0 / a)), cbrt((pow(h, 2.0) * (-0.25 / (g * a)))));
} else {
tmp = cbrt(pow((h * ((cbrt((-g / a)) / h) + cbrt((((1.0 / a) * -0.25) / (g * h))))), 3.0));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if (h <= 9.8e+142) tmp = fma(cbrt(g), cbrt(Float64(-1.0 / a)), cbrt(Float64((h ^ 2.0) * Float64(-0.25 / Float64(g * a))))); else tmp = cbrt((Float64(h * Float64(Float64(cbrt(Float64(Float64(-g) / a)) / h) + cbrt(Float64(Float64(Float64(1.0 / a) * -0.25) / Float64(g * h))))) ^ 3.0)); end return tmp end
code[g_, h_, a_] := If[LessEqual[h, 9.8e+142], N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[N[(-1.0 / a), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[Power[h, 2.0], $MachinePrecision] * N[(-0.25 / N[(g * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(h * N[(N[(N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision] / h), $MachinePrecision] + N[Power[N[(N[(N[(1.0 / a), $MachinePrecision] * -0.25), $MachinePrecision] / N[(g * h), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq 9.8 \cdot 10^{+142}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{g}, \sqrt[3]{\frac{-1}{a}}, \sqrt[3]{{h}^{2} \cdot \frac{-0.25}{g \cdot a}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(h \cdot \left(\frac{\sqrt[3]{\frac{-g}{a}}}{h} + \sqrt[3]{\frac{\frac{1}{a} \cdot -0.25}{g \cdot h}}\right)\right)}^{3}}\\
\end{array}
\end{array}
if h < 9.80000000000000101e142Initial program 44.3%
Simplified44.3%
Taylor expanded in h around 0 68.3%
pow1/334.6%
div-inv34.6%
unpow-prod-down22.8%
pow1/344.8%
Applied egg-rr44.8%
unpow1/389.4%
Simplified89.4%
associate-*l*89.4%
fma-define89.4%
cbrt-unprod89.9%
metadata-eval89.9%
cbrt-unprod89.9%
*-commutative89.9%
cbrt-unprod89.9%
metadata-eval89.9%
cbrt-unprod89.9%
*-commutative89.9%
Applied egg-rr89.9%
associate-*l/89.9%
metadata-eval89.9%
*-commutative89.9%
associate-*l/89.9%
associate-/l*88.3%
Simplified88.3%
if 9.80000000000000101e142 < h Initial program 0.5%
Simplified0.5%
Taylor expanded in h around 0 14.3%
Taylor expanded in h around inf 45.3%
+-commutative45.3%
cbrt-div90.6%
add-cube-cbrt90.2%
fma-define90.1%
Applied egg-rr45.1%
add-cbrt-cube45.1%
pow345.1%
Applied egg-rr45.9%
Final simplification86.8%
(FPCore (g h a) :precision binary64 (if (<= h 7.8e-271) (pow (- 0.0 (pow (/ g a) 0.1111111111111111)) 3.0) (* h (/ (cbrt (/ g a)) (- h)))))
double code(double g, double h, double a) {
double tmp;
if (h <= 7.8e-271) {
tmp = pow((0.0 - pow((g / a), 0.1111111111111111)), 3.0);
} else {
tmp = h * (cbrt((g / a)) / -h);
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if (h <= 7.8e-271) {
tmp = Math.pow((0.0 - Math.pow((g / a), 0.1111111111111111)), 3.0);
} else {
tmp = h * (Math.cbrt((g / a)) / -h);
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if (h <= 7.8e-271) tmp = Float64(0.0 - (Float64(g / a) ^ 0.1111111111111111)) ^ 3.0; else tmp = Float64(h * Float64(cbrt(Float64(g / a)) / Float64(-h))); end return tmp end
code[g_, h_, a_] := If[LessEqual[h, 7.8e-271], N[Power[N[(0.0 - N[Power[N[(g / a), $MachinePrecision], 0.1111111111111111], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], N[(h * N[(N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision] / (-h)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq 7.8 \cdot 10^{-271}:\\
\;\;\;\;{\left(0 - {\left(\frac{g}{a}\right)}^{0.1111111111111111}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;h \cdot \frac{\sqrt[3]{\frac{g}{a}}}{-h}\\
\end{array}
\end{array}
if h < 7.79999999999999995e-271Initial program 42.2%
Simplified42.2%
Taylor expanded in h around 0 66.3%
add-cube-cbrt65.9%
pow365.9%
Applied egg-rr65.9%
Taylor expanded in g around -inf 40.1%
mul-1-neg40.1%
neg-sub040.1%
*-lft-identity40.1%
Simplified40.1%
if 7.79999999999999995e-271 < h Initial program 43.4%
Simplified43.4%
Taylor expanded in h around 0 66.6%
Taylor expanded in h around inf 58.5%
+-commutative58.5%
cbrt-div76.7%
add-cube-cbrt76.2%
fma-define76.2%
Applied egg-rr58.4%
Taylor expanded in g around -inf 66.9%
mul-1-neg66.9%
associate-*r/67.1%
*-rgt-identity67.1%
distribute-neg-frac267.1%
Simplified67.1%
(FPCore (g h a) :precision binary64 (+ (cbrt (/ (- g) a)) (cbrt (* (/ -0.5 a) (- g g)))))
double code(double g, double h, double a) {
return cbrt((-g / a)) + cbrt(((-0.5 / a) * (g - g)));
}
public static double code(double g, double h, double a) {
return Math.cbrt((-g / a)) + Math.cbrt(((-0.5 / a) * (g - g)));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(-g) / a)) + cbrt(Float64(Float64(-0.5 / a) * Float64(g - g)))) end
code[g_, h_, a_] := N[(N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g - g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{-g}{a}} + \sqrt[3]{\frac{-0.5}{a} \cdot \left(g - g\right)}
\end{array}
Initial program 42.7%
Simplified42.7%
Taylor expanded in g around -inf 24.8%
associate-*r/24.8%
neg-mul-124.8%
Simplified24.8%
Taylor expanded in g around -inf 73.6%
neg-mul-173.6%
Simplified73.6%
Final simplification73.6%
(FPCore (g h a) :precision binary64 (* h (/ (cbrt (/ g a)) (- h))))
double code(double g, double h, double a) {
return h * (cbrt((g / a)) / -h);
}
public static double code(double g, double h, double a) {
return h * (Math.cbrt((g / a)) / -h);
}
function code(g, h, a) return Float64(h * Float64(cbrt(Float64(g / a)) / Float64(-h))) end
code[g_, h_, a_] := N[(h * N[(N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision] / (-h)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
h \cdot \frac{\sqrt[3]{\frac{g}{a}}}{-h}
\end{array}
Initial program 42.7%
Simplified42.7%
Taylor expanded in h around 0 66.4%
Taylor expanded in h around inf 54.7%
+-commutative54.7%
cbrt-div67.8%
add-cube-cbrt67.5%
fma-define67.5%
Applied egg-rr54.7%
Taylor expanded in g around -inf 65.7%
mul-1-neg65.7%
associate-*r/65.8%
*-rgt-identity65.8%
distribute-neg-frac265.8%
Simplified65.8%
(FPCore (g h a) :precision binary64 (* (/ 1.0 (cbrt (/ a g))) -2.0))
double code(double g, double h, double a) {
return (1.0 / cbrt((a / g))) * -2.0;
}
public static double code(double g, double h, double a) {
return (1.0 / Math.cbrt((a / g))) * -2.0;
}
function code(g, h, a) return Float64(Float64(1.0 / cbrt(Float64(a / g))) * -2.0) end
code[g_, h_, a_] := N[(N[(1.0 / N[Power[N[(a / g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt[3]{\frac{a}{g}}} \cdot -2
\end{array}
Initial program 42.7%
Simplified42.7%
Taylor expanded in g around -inf 24.8%
associate-*r/24.8%
neg-mul-124.8%
Simplified24.8%
Taylor expanded in g around inf 15.2%
Taylor expanded in g around -inf 15.2%
*-commutative15.2%
Simplified15.2%
clear-num54.5%
cbrt-div55.4%
metadata-eval55.4%
Applied egg-rr15.5%
(FPCore (g h a) :precision binary64 (* (cbrt (/ g a)) -2.0))
double code(double g, double h, double a) {
return cbrt((g / a)) * -2.0;
}
public static double code(double g, double h, double a) {
return Math.cbrt((g / a)) * -2.0;
}
function code(g, h, a) return Float64(cbrt(Float64(g / a)) * -2.0) end
code[g_, h_, a_] := N[(N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision] * -2.0), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{g}{a}} \cdot -2
\end{array}
Initial program 42.7%
Simplified42.7%
Taylor expanded in g around -inf 24.8%
associate-*r/24.8%
neg-mul-124.8%
Simplified24.8%
Taylor expanded in g around inf 15.2%
Taylor expanded in g around -inf 15.2%
*-commutative15.2%
Simplified15.2%
herbie shell --seed 2024119
(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))))))))