
(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 9 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
(if (<= g 4.2e-119)
(fma
(* (cbrt -1.0) (cbrt g))
(pow (cbrt a) -1.0)
(* (* (cbrt 0.5) (cbrt -0.5)) (cbrt (* (/ h g) (/ h a)))))
(fma
(cbrt (/ 0.5 a))
(cbrt (- (fma (sqrt (- g h)) (sqrt (+ h g)) g)))
(cbrt (* (* (* -0.5 h) (/ h g)) (/ 0.5 a))))))
double code(double g, double h, double a) {
double tmp;
if (g <= 4.2e-119) {
tmp = fma((cbrt(-1.0) * cbrt(g)), pow(cbrt(a), -1.0), ((cbrt(0.5) * cbrt(-0.5)) * cbrt(((h / g) * (h / a)))));
} else {
tmp = fma(cbrt((0.5 / a)), cbrt(-fma(sqrt((g - h)), sqrt((h + g)), g)), cbrt((((-0.5 * h) * (h / g)) * (0.5 / a))));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if (g <= 4.2e-119) tmp = fma(Float64(cbrt(-1.0) * cbrt(g)), (cbrt(a) ^ -1.0), Float64(Float64(cbrt(0.5) * cbrt(-0.5)) * cbrt(Float64(Float64(h / g) * Float64(h / a))))); else tmp = fma(cbrt(Float64(0.5 / a)), cbrt(Float64(-fma(sqrt(Float64(g - h)), sqrt(Float64(h + g)), g))), cbrt(Float64(Float64(Float64(-0.5 * h) * Float64(h / g)) * Float64(0.5 / a)))); end return tmp end
code[g_, h_, a_] := If[LessEqual[g, 4.2e-119], N[(N[(N[Power[-1.0, 1/3], $MachinePrecision] * N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[N[Power[a, 1/3], $MachinePrecision], -1.0], $MachinePrecision] + N[(N[(N[Power[0.5, 1/3], $MachinePrecision] * N[Power[-0.5, 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(h / g), $MachinePrecision] * N[(h / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[(-N[(N[Sqrt[N[(g - h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(h + g), $MachinePrecision]], $MachinePrecision] + g), $MachinePrecision]), 1/3], $MachinePrecision] + N[Power[N[(N[(N[(-0.5 * h), $MachinePrecision] * N[(h / g), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq 4.2 \cdot 10^{-119}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{-1} \cdot \sqrt[3]{g}, {\left(\sqrt[3]{a}\right)}^{-1}, \left(\sqrt[3]{0.5} \cdot \sqrt[3]{-0.5}\right) \cdot \sqrt[3]{\frac{h}{g} \cdot \frac{h}{a}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{\frac{0.5}{a}}, \sqrt[3]{-\mathsf{fma}\left(\sqrt{g - h}, \sqrt{h + g}, g\right)}, \sqrt[3]{\left(\left(-0.5 \cdot h\right) \cdot \frac{h}{g}\right) \cdot \frac{0.5}{a}}\right)\\
\end{array}
\end{array}
if g < 4.2e-119Initial program 37.4%
Taylor expanded in g around -inf
mul-1-negN/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cbrt.f64N/A
lower-/.f64N/A
lower-cbrt.f64N/A
lower-neg.f64N/A
lower-cbrt.f6436.5
Applied rewrites36.5%
Applied rewrites38.1%
Taylor expanded in g around inf
lower-*.f64N/A
lower-cbrt.f64N/A
lower-cbrt.f6421.2
Applied rewrites21.2%
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.f6491.0
Applied rewrites91.0%
if 4.2e-119 < g Initial program 46.4%
Taylor expanded in g around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6448.2
Applied rewrites48.2%
lift-cbrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
+-commutativeN/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites48.5%
Applied rewrites96.8%
Final simplification93.7%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (/ (- g) a))
(t_1 (cbrt (* (* (/ h g) (/ h a)) -0.25)))
(t_2 (sqrt (- (* g g) (* h h))))
(t_3
(+
(cbrt (* (- t_2 g) (/ 1.0 (* 2.0 a))))
(cbrt (* (/ -1.0 (* 2.0 a)) (+ t_2 g))))))
(if (<= t_3 -4e-95)
(+ (cbrt (fma (/ 0.25 a) (/ (* h h) g) t_0)) t_1)
(if (<= t_3 0.0)
(+ (- (cbrt (/ g a))) (/ (cbrt (- g)) (cbrt a)))
(+ t_1 (cbrt t_0))))))
double code(double g, double h, double a) {
double t_0 = -g / a;
double t_1 = cbrt((((h / g) * (h / a)) * -0.25));
double t_2 = sqrt(((g * g) - (h * h)));
double t_3 = cbrt(((t_2 - g) * (1.0 / (2.0 * a)))) + cbrt(((-1.0 / (2.0 * a)) * (t_2 + g)));
double tmp;
if (t_3 <= -4e-95) {
tmp = cbrt(fma((0.25 / a), ((h * h) / g), t_0)) + t_1;
} else if (t_3 <= 0.0) {
tmp = -cbrt((g / a)) + (cbrt(-g) / cbrt(a));
} else {
tmp = t_1 + cbrt(t_0);
}
return tmp;
}
function code(g, h, a) t_0 = Float64(Float64(-g) / a) t_1 = cbrt(Float64(Float64(Float64(h / g) * Float64(h / a)) * -0.25)) t_2 = sqrt(Float64(Float64(g * g) - Float64(h * h))) t_3 = Float64(cbrt(Float64(Float64(t_2 - g) * Float64(1.0 / Float64(2.0 * a)))) + cbrt(Float64(Float64(-1.0 / Float64(2.0 * a)) * Float64(t_2 + g)))) tmp = 0.0 if (t_3 <= -4e-95) tmp = Float64(cbrt(fma(Float64(0.25 / a), Float64(Float64(h * h) / g), t_0)) + t_1); elseif (t_3 <= 0.0) tmp = Float64(Float64(-cbrt(Float64(g / a))) + Float64(cbrt(Float64(-g)) / cbrt(a))); else tmp = Float64(t_1 + cbrt(t_0)); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[((-g) / a), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(N[(h / g), $MachinePrecision] * N[(h / a), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[N[(N[(t$95$2 - g), $MachinePrecision] * N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(-1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -4e-95], N[(N[Power[N[(N[(0.25 / a), $MachinePrecision] * N[(N[(h * h), $MachinePrecision] / g), $MachinePrecision] + t$95$0), $MachinePrecision], 1/3], $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[((-N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]) + N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[Power[t$95$0, 1/3], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-g}{a}\\
t_1 := \sqrt[3]{\left(\frac{h}{g} \cdot \frac{h}{a}\right) \cdot -0.25}\\
t_2 := \sqrt{g \cdot g - h \cdot h}\\
t_3 := \sqrt[3]{\left(t\_2 - g\right) \cdot \frac{1}{2 \cdot a}} + \sqrt[3]{\frac{-1}{2 \cdot a} \cdot \left(t\_2 + g\right)}\\
\mathbf{if}\;t\_3 \leq -4 \cdot 10^{-95}:\\
\;\;\;\;\sqrt[3]{\mathsf{fma}\left(\frac{0.25}{a}, \frac{h \cdot h}{g}, t\_0\right)} + t\_1\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\left(-\sqrt[3]{\frac{g}{a}}\right) + \frac{\sqrt[3]{-g}}{\sqrt[3]{a}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \sqrt[3]{t\_0}\\
\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))))))) < -3.99999999999999996e-95Initial program 92.8%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6458.5
Applied rewrites58.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.f6494.9
Applied rewrites94.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6494.9
Applied rewrites94.9%
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.f6495.5
Applied rewrites95.5%
if -3.99999999999999996e-95 < (+.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))))))) < 0.0Initial program 4.4%
Taylor expanded in g around -inf
mul-1-negN/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cbrt.f64N/A
lower-/.f64N/A
lower-cbrt.f64N/A
lower-neg.f64N/A
lower-cbrt.f647.7
Applied rewrites7.7%
Applied rewrites11.0%
Taylor expanded in g around inf
lower-*.f64N/A
lower-cbrt.f64N/A
lower-cbrt.f6478.2
Applied rewrites78.2%
lift-fma.f64N/A
lower-+.f64N/A
Applied rewrites77.8%
if 0.0 < (+.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 27.7%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6418.5
Applied rewrites18.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.f6471.2
Applied rewrites71.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6471.2
Applied rewrites71.2%
Final simplification77.1%
(FPCore (g h a)
:precision binary64
(if (<= g -1.05e+149)
(+ (cbrt (* (* (/ h g) (/ h a)) -0.25)) (cbrt (/ (- g) a)))
(if (<= g 2.05e-265)
(+
(cbrt (* (/ -1.0 (* 2.0 a)) (+ (sqrt (- (* g g) (* h h))) g)))
(*
(* (- (cbrt 0.5)) (* (cbrt (pow (- a) -1.0)) (cbrt (- g))))
(cbrt 2.0)))
(fma
(cbrt (/ 0.5 a))
(cbrt (- (fma (sqrt (- g h)) (sqrt (+ h g)) g)))
(cbrt (* (* (* -0.5 h) (/ h g)) (/ 0.5 a)))))))
double code(double g, double h, double a) {
double tmp;
if (g <= -1.05e+149) {
tmp = cbrt((((h / g) * (h / a)) * -0.25)) + cbrt((-g / a));
} else if (g <= 2.05e-265) {
tmp = cbrt(((-1.0 / (2.0 * a)) * (sqrt(((g * g) - (h * h))) + g))) + ((-cbrt(0.5) * (cbrt(pow(-a, -1.0)) * cbrt(-g))) * cbrt(2.0));
} else {
tmp = fma(cbrt((0.5 / a)), cbrt(-fma(sqrt((g - h)), sqrt((h + g)), g)), cbrt((((-0.5 * h) * (h / g)) * (0.5 / a))));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if (g <= -1.05e+149) tmp = Float64(cbrt(Float64(Float64(Float64(h / g) * Float64(h / a)) * -0.25)) + cbrt(Float64(Float64(-g) / a))); elseif (g <= 2.05e-265) tmp = Float64(cbrt(Float64(Float64(-1.0 / Float64(2.0 * a)) * Float64(sqrt(Float64(Float64(g * g) - Float64(h * h))) + g))) + Float64(Float64(Float64(-cbrt(0.5)) * Float64(cbrt((Float64(-a) ^ -1.0)) * cbrt(Float64(-g)))) * cbrt(2.0))); else tmp = fma(cbrt(Float64(0.5 / a)), cbrt(Float64(-fma(sqrt(Float64(g - h)), sqrt(Float64(h + g)), g))), cbrt(Float64(Float64(Float64(-0.5 * h) * Float64(h / g)) * Float64(0.5 / a)))); end return tmp end
code[g_, h_, a_] := If[LessEqual[g, -1.05e+149], N[(N[Power[N[(N[(N[(h / g), $MachinePrecision] * N[(h / a), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, 2.05e-265], N[(N[Power[N[(N[(-1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[((-N[Power[0.5, 1/3], $MachinePrecision]) * N[(N[Power[N[Power[(-a), -1.0], $MachinePrecision], 1/3], $MachinePrecision] * N[Power[(-g), 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[2.0, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[(-N[(N[Sqrt[N[(g - h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(h + g), $MachinePrecision]], $MachinePrecision] + g), $MachinePrecision]), 1/3], $MachinePrecision] + N[Power[N[(N[(N[(-0.5 * h), $MachinePrecision] * N[(h / g), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq -1.05 \cdot 10^{+149}:\\
\;\;\;\;\sqrt[3]{\left(\frac{h}{g} \cdot \frac{h}{a}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\
\mathbf{elif}\;g \leq 2.05 \cdot 10^{-265}:\\
\;\;\;\;\sqrt[3]{\frac{-1}{2 \cdot a} \cdot \left(\sqrt{g \cdot g - h \cdot h} + g\right)} + \left(\left(-\sqrt[3]{0.5}\right) \cdot \left(\sqrt[3]{{\left(-a\right)}^{-1}} \cdot \sqrt[3]{-g}\right)\right) \cdot \sqrt[3]{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{\frac{0.5}{a}}, \sqrt[3]{-\mathsf{fma}\left(\sqrt{g - h}, \sqrt{h + g}, g\right)}, \sqrt[3]{\left(\left(-0.5 \cdot h\right) \cdot \frac{h}{g}\right) \cdot \frac{0.5}{a}}\right)\\
\end{array}
\end{array}
if g < -1.0500000000000001e149Initial program 4.5%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f643.8
Applied rewrites3.8%
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.f6470.1
Applied rewrites70.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6470.1
Applied rewrites70.1%
if -1.0500000000000001e149 < g < 2.05e-265Initial program 72.7%
Taylor expanded in g around -inf
mul-1-negN/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cbrt.f64N/A
lower-/.f64N/A
lower-cbrt.f64N/A
lower-neg.f64N/A
lower-cbrt.f6472.1
Applied rewrites72.1%
Applied rewrites88.2%
if 2.05e-265 < g Initial program 45.2%
Taylor expanded in g around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6447.3
Applied rewrites47.3%
lift-cbrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
+-commutativeN/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites47.5%
Applied rewrites96.9%
Final simplification87.8%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (sqrt (- (* g g) (* h h)))) (t_1 (sqrt (* (+ h g) (- g h)))))
(if (<=
(+
(cbrt (* (- t_0 g) (/ 1.0 (* 2.0 a))))
(cbrt (* (/ -1.0 (* 2.0 a)) (+ t_0 g))))
INFINITY)
(* (+ (cbrt (- (- g) t_1)) (cbrt (- t_1 g))) (cbrt (/ 0.5 a)))
(+ (cbrt (* (* (/ h g) (/ h a)) -0.25)) (cbrt (/ (- g) a))))))
double code(double g, double h, double a) {
double t_0 = sqrt(((g * g) - (h * h)));
double t_1 = sqrt(((h + g) * (g - h)));
double tmp;
if ((cbrt(((t_0 - g) * (1.0 / (2.0 * a)))) + cbrt(((-1.0 / (2.0 * a)) * (t_0 + g)))) <= ((double) INFINITY)) {
tmp = (cbrt((-g - t_1)) + cbrt((t_1 - g))) * cbrt((0.5 / a));
} else {
tmp = cbrt((((h / g) * (h / a)) * -0.25)) + cbrt((-g / a));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.sqrt(((g * g) - (h * h)));
double t_1 = Math.sqrt(((h + g) * (g - h)));
double tmp;
if ((Math.cbrt(((t_0 - g) * (1.0 / (2.0 * a)))) + Math.cbrt(((-1.0 / (2.0 * a)) * (t_0 + g)))) <= Double.POSITIVE_INFINITY) {
tmp = (Math.cbrt((-g - t_1)) + Math.cbrt((t_1 - g))) * Math.cbrt((0.5 / a));
} else {
tmp = Math.cbrt((((h / g) * (h / a)) * -0.25)) + Math.cbrt((-g / a));
}
return tmp;
}
function code(g, h, a) t_0 = sqrt(Float64(Float64(g * g) - Float64(h * h))) t_1 = sqrt(Float64(Float64(h + g) * Float64(g - h))) tmp = 0.0 if (Float64(cbrt(Float64(Float64(t_0 - g) * Float64(1.0 / Float64(2.0 * a)))) + cbrt(Float64(Float64(-1.0 / Float64(2.0 * a)) * Float64(t_0 + g)))) <= Inf) tmp = Float64(Float64(cbrt(Float64(Float64(-g) - t_1)) + cbrt(Float64(t_1 - g))) * cbrt(Float64(0.5 / a))); else tmp = Float64(cbrt(Float64(Float64(Float64(h / g) * Float64(h / a)) * -0.25)) + cbrt(Float64(Float64(-g) / a))); 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[Sqrt[N[(N[(h + g), $MachinePrecision] * N[(g - h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(t$95$0 - g), $MachinePrecision] * N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(-1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[Power[N[((-g) - t$95$1), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(t$95$1 - g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(N[(h / g), $MachinePrecision] * N[(h / a), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{g \cdot g - h \cdot h}\\
t_1 := \sqrt{\left(h + g\right) \cdot \left(g - h\right)}\\
\mathbf{if}\;\sqrt[3]{\left(t\_0 - g\right) \cdot \frac{1}{2 \cdot a}} + \sqrt[3]{\frac{-1}{2 \cdot a} \cdot \left(t\_0 + g\right)} \leq \infty:\\
\;\;\;\;\left(\sqrt[3]{\left(-g\right) - t\_1} + \sqrt[3]{t\_1 - g}\right) \cdot \sqrt[3]{\frac{0.5}{a}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\left(\frac{h}{g} \cdot \frac{h}{a}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{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))))))) < +inf.0Initial program 78.3%
lift-cbrt.f64N/A
pow1/3N/A
lift-*.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
pow1/3N/A
lower-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f64N/A
pow1/3N/A
lower-cbrt.f6483.2
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6483.2
Applied rewrites83.2%
lift-+.f64N/A
lift-*.f64N/A
lift-cbrt.f64N/A
lift-*.f64N/A
cbrt-prodN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
metadata-evalN/A
lift-/.f64N/A
lift-cbrt.f64N/A
Applied rewrites88.0%
if +inf.0 < (+.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.0%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f641.7
Applied rewrites1.7%
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%
Final simplification76.5%
(FPCore (g h a)
:precision binary64
(if (<= g -1.05e+149)
(+ (cbrt (* (* (/ h g) (/ h a)) -0.25)) (cbrt (/ (- g) a)))
(if (<= g -2e-255)
(+
(* (* (/ (cbrt g) (cbrt a)) (cbrt 0.5)) (- (cbrt 2.0)))
(cbrt (* (/ -1.0 (* 2.0 a)) (+ (sqrt (- (* g g) (* h h))) g))))
(fma
(cbrt (/ 0.5 a))
(cbrt (- (fma (sqrt (- g h)) (sqrt (+ h g)) g)))
(cbrt (* (* (* -0.5 h) (/ h g)) (/ 0.5 a)))))))
double code(double g, double h, double a) {
double tmp;
if (g <= -1.05e+149) {
tmp = cbrt((((h / g) * (h / a)) * -0.25)) + cbrt((-g / a));
} else if (g <= -2e-255) {
tmp = (((cbrt(g) / cbrt(a)) * cbrt(0.5)) * -cbrt(2.0)) + cbrt(((-1.0 / (2.0 * a)) * (sqrt(((g * g) - (h * h))) + g)));
} else {
tmp = fma(cbrt((0.5 / a)), cbrt(-fma(sqrt((g - h)), sqrt((h + g)), g)), cbrt((((-0.5 * h) * (h / g)) * (0.5 / a))));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if (g <= -1.05e+149) tmp = Float64(cbrt(Float64(Float64(Float64(h / g) * Float64(h / a)) * -0.25)) + cbrt(Float64(Float64(-g) / a))); elseif (g <= -2e-255) tmp = Float64(Float64(Float64(Float64(cbrt(g) / cbrt(a)) * cbrt(0.5)) * Float64(-cbrt(2.0))) + cbrt(Float64(Float64(-1.0 / Float64(2.0 * a)) * Float64(sqrt(Float64(Float64(g * g) - Float64(h * h))) + g)))); else tmp = fma(cbrt(Float64(0.5 / a)), cbrt(Float64(-fma(sqrt(Float64(g - h)), sqrt(Float64(h + g)), g))), cbrt(Float64(Float64(Float64(-0.5 * h) * Float64(h / g)) * Float64(0.5 / a)))); end return tmp end
code[g_, h_, a_] := If[LessEqual[g, -1.05e+149], N[(N[Power[N[(N[(N[(h / g), $MachinePrecision] * N[(h / a), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[g, -2e-255], N[(N[(N[(N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[0.5, 1/3], $MachinePrecision]), $MachinePrecision] * (-N[Power[2.0, 1/3], $MachinePrecision])), $MachinePrecision] + N[Power[N[(N[(-1.0 / N[(2.0 * a), $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[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[(-N[(N[Sqrt[N[(g - h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(h + g), $MachinePrecision]], $MachinePrecision] + g), $MachinePrecision]), 1/3], $MachinePrecision] + N[Power[N[(N[(N[(-0.5 * h), $MachinePrecision] * N[(h / g), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq -1.05 \cdot 10^{+149}:\\
\;\;\;\;\sqrt[3]{\left(\frac{h}{g} \cdot \frac{h}{a}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\
\mathbf{elif}\;g \leq -2 \cdot 10^{-255}:\\
\;\;\;\;\left(\frac{\sqrt[3]{g}}{\sqrt[3]{a}} \cdot \sqrt[3]{0.5}\right) \cdot \left(-\sqrt[3]{2}\right) + \sqrt[3]{\frac{-1}{2 \cdot a} \cdot \left(\sqrt{g \cdot g - h \cdot h} + g\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{\frac{0.5}{a}}, \sqrt[3]{-\mathsf{fma}\left(\sqrt{g - h}, \sqrt{h + g}, g\right)}, \sqrt[3]{\left(\left(-0.5 \cdot h\right) \cdot \frac{h}{g}\right) \cdot \frac{0.5}{a}}\right)\\
\end{array}
\end{array}
if g < -1.0500000000000001e149Initial program 4.5%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f643.8
Applied rewrites3.8%
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.f6470.1
Applied rewrites70.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6470.1
Applied rewrites70.1%
if -1.0500000000000001e149 < g < -2e-255Initial program 73.8%
Taylor expanded in g around -inf
mul-1-negN/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cbrt.f64N/A
lower-/.f64N/A
lower-cbrt.f64N/A
lower-neg.f64N/A
lower-cbrt.f6473.2
Applied rewrites73.2%
Applied rewrites87.7%
if -2e-255 < g Initial program 44.8%
Taylor expanded in g around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6447.0
Applied rewrites47.0%
lift-cbrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
+-commutativeN/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites47.2%
Applied rewrites96.9%
Final simplification87.8%
(FPCore (g h a)
:precision binary64
(if (<= g -2e-255)
(+ (cbrt (* (* (/ h g) (/ h a)) -0.25)) (cbrt (/ (- g) a)))
(fma
(cbrt (/ 0.5 a))
(cbrt (- (fma (sqrt (- g h)) (sqrt (+ h g)) g)))
(cbrt (* (* (* -0.5 h) (/ h g)) (/ 0.5 a))))))
double code(double g, double h, double a) {
double tmp;
if (g <= -2e-255) {
tmp = cbrt((((h / g) * (h / a)) * -0.25)) + cbrt((-g / a));
} else {
tmp = fma(cbrt((0.5 / a)), cbrt(-fma(sqrt((g - h)), sqrt((h + g)), g)), cbrt((((-0.5 * h) * (h / g)) * (0.5 / a))));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if (g <= -2e-255) tmp = Float64(cbrt(Float64(Float64(Float64(h / g) * Float64(h / a)) * -0.25)) + cbrt(Float64(Float64(-g) / a))); else tmp = fma(cbrt(Float64(0.5 / a)), cbrt(Float64(-fma(sqrt(Float64(g - h)), sqrt(Float64(h + g)), g))), cbrt(Float64(Float64(Float64(-0.5 * h) * Float64(h / g)) * Float64(0.5 / a)))); end return tmp end
code[g_, h_, a_] := If[LessEqual[g, -2e-255], N[(N[Power[N[(N[(N[(h / g), $MachinePrecision] * N[(h / a), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[((-g) / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[(-N[(N[Sqrt[N[(g - h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(h + g), $MachinePrecision]], $MachinePrecision] + g), $MachinePrecision]), 1/3], $MachinePrecision] + N[Power[N[(N[(N[(-0.5 * h), $MachinePrecision] * N[(h / g), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;g \leq -2 \cdot 10^{-255}:\\
\;\;\;\;\sqrt[3]{\left(\frac{h}{g} \cdot \frac{h}{a}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{\frac{0.5}{a}}, \sqrt[3]{-\mathsf{fma}\left(\sqrt{g - h}, \sqrt{h + g}, g\right)}, \sqrt[3]{\left(\left(-0.5 \cdot h\right) \cdot \frac{h}{g}\right) \cdot \frac{0.5}{a}}\right)\\
\end{array}
\end{array}
if g < -2e-255Initial program 38.4%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f649.7
Applied rewrites9.7%
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.2
Applied rewrites74.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.2
Applied rewrites74.2%
if -2e-255 < g Initial program 44.8%
Taylor expanded in g around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6447.0
Applied rewrites47.0%
lift-cbrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
+-commutativeN/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites47.2%
Applied rewrites96.9%
Final simplification85.5%
(FPCore (g h a) :precision binary64 (+ (cbrt (* (* (/ h g) (/ h a)) -0.25)) (cbrt (/ (- g) a))))
double code(double g, double h, double a) {
return cbrt((((h / g) * (h / a)) * -0.25)) + cbrt((-g / a));
}
public static double code(double g, double h, double a) {
return Math.cbrt((((h / g) * (h / a)) * -0.25)) + Math.cbrt((-g / a));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(Float64(h / g) * Float64(h / a)) * -0.25)) + cbrt(Float64(Float64(-g) / a))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(N[(h / g), $MachinePrecision] * N[(h / a), $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}{g} \cdot \frac{h}{a}\right) \cdot -0.25} + \sqrt[3]{\frac{-g}{a}}
\end{array}
Initial program 41.6%
Taylor expanded in g around inf
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6427.2
Applied rewrites27.2%
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.f6473.9
Applied rewrites73.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6473.9
Applied rewrites73.9%
Final simplification73.9%
(FPCore (g h a) :precision binary64 (* (cbrt (/ g a)) (cbrt -1.0)))
double code(double g, double h, double a) {
return cbrt((g / a)) * cbrt(-1.0);
}
public static double code(double g, double h, double a) {
return Math.cbrt((g / a)) * Math.cbrt(-1.0);
}
function code(g, h, a) return Float64(cbrt(Float64(g / a)) * cbrt(-1.0)) end
code[g_, h_, a_] := N[(N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[-1.0, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{g}{a}} \cdot \sqrt[3]{-1}
\end{array}
Initial program 41.6%
Taylor expanded in g around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6424.7
Applied rewrites24.7%
lift-cbrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
+-commutativeN/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-lft-identityN/A
*-commutativeN/A
Applied rewrites24.8%
Taylor expanded in g around inf
lower-*.f64N/A
lower-cbrt.f64N/A
lower-/.f64N/A
lower-cbrt.f6472.2
Applied rewrites72.2%
(FPCore (g h a) :precision binary64 0.0)
double code(double g, double h, double a) {
return 0.0;
}
real(8) function code(g, h, a)
real(8), intent (in) :: g
real(8), intent (in) :: h
real(8), intent (in) :: a
code = 0.0d0
end function
public static double code(double g, double h, double a) {
return 0.0;
}
def code(g, h, a): return 0.0
function code(g, h, a) return 0.0 end
function tmp = code(g, h, a) tmp = 0.0; end
code[g_, h_, a_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 41.6%
lift-cbrt.f64N/A
pow1/3N/A
lift-*.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
pow1/3N/A
lower-cbrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f64N/A
pow1/3N/A
lower-cbrt.f6444.2
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6444.2
Applied rewrites44.2%
Taylor expanded in g around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
unpow2N/A
rem-square-sqrtN/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
lower-cbrt.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-cbrt.f642.9
Applied rewrites2.9%
Taylor expanded in a around 0
Applied rewrites2.9%
herbie shell --seed 2024270
(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))))))))