
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma b b (* c (* a -4.0)))) (t_1 (* (/ c (pow b 3.0)) -0.5)))
(if (<= b 1.15)
(/
-1.0
(/
(* a 2.0)
(/ (- (pow b 3.0) (pow t_0 1.5)) (+ t_0 (fma b b (* b (sqrt t_0)))))))
(/
1.0
(fma
-1.0
(/ b c)
(*
a
(fma
a
(*
-2.0
(+
t_1
(*
a
(fma
-1.0
(* c (/ t_1 (pow b 2.0)))
(fma
-0.125
(* b (/ (* (/ (pow c 4.0) (pow b 6.0)) 20.0) (pow c 2.0)))
(/ (pow c 2.0) (pow b 5.0)))))))
(/ 1.0 b))))))))
double code(double a, double b, double c) {
double t_0 = fma(b, b, (c * (a * -4.0)));
double t_1 = (c / pow(b, 3.0)) * -0.5;
double tmp;
if (b <= 1.15) {
tmp = -1.0 / ((a * 2.0) / ((pow(b, 3.0) - pow(t_0, 1.5)) / (t_0 + fma(b, b, (b * sqrt(t_0))))));
} else {
tmp = 1.0 / fma(-1.0, (b / c), (a * fma(a, (-2.0 * (t_1 + (a * fma(-1.0, (c * (t_1 / pow(b, 2.0))), fma(-0.125, (b * (((pow(c, 4.0) / pow(b, 6.0)) * 20.0) / pow(c, 2.0))), (pow(c, 2.0) / pow(b, 5.0))))))), (1.0 / b))));
}
return tmp;
}
function code(a, b, c) t_0 = fma(b, b, Float64(c * Float64(a * -4.0))) t_1 = Float64(Float64(c / (b ^ 3.0)) * -0.5) tmp = 0.0 if (b <= 1.15) tmp = Float64(-1.0 / Float64(Float64(a * 2.0) / Float64(Float64((b ^ 3.0) - (t_0 ^ 1.5)) / Float64(t_0 + fma(b, b, Float64(b * sqrt(t_0))))))); else tmp = Float64(1.0 / fma(-1.0, Float64(b / c), Float64(a * fma(a, Float64(-2.0 * Float64(t_1 + Float64(a * fma(-1.0, Float64(c * Float64(t_1 / (b ^ 2.0))), fma(-0.125, Float64(b * Float64(Float64(Float64((c ^ 4.0) / (b ^ 6.0)) * 20.0) / (c ^ 2.0))), Float64((c ^ 2.0) / (b ^ 5.0))))))), Float64(1.0 / b))))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[b, 1.15], N[(-1.0 / N[(N[(a * 2.0), $MachinePrecision] / N[(N[(N[Power[b, 3.0], $MachinePrecision] - N[Power[t$95$0, 1.5], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(b * b + N[(b * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(-1.0 * N[(b / c), $MachinePrecision] + N[(a * N[(a * N[(-2.0 * N[(t$95$1 + N[(a * N[(-1.0 * N[(c * N[(t$95$1 / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.125 * N[(b * N[(N[(N[(N[Power[c, 4.0], $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision] * 20.0), $MachinePrecision] / N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\\
t_1 := \frac{c}{{b}^{3}} \cdot -0.5\\
\mathbf{if}\;b \leq 1.15:\\
\;\;\;\;\frac{-1}{\frac{a \cdot 2}{\frac{{b}^{3} - {t\_0}^{1.5}}{t\_0 + \mathsf{fma}\left(b, b, b \cdot \sqrt{t\_0}\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(-1, \frac{b}{c}, a \cdot \mathsf{fma}\left(a, -2 \cdot \left(t\_1 + a \cdot \mathsf{fma}\left(-1, c \cdot \frac{t\_1}{{b}^{2}}, \mathsf{fma}\left(-0.125, b \cdot \frac{\frac{{c}^{4}}{{b}^{6}} \cdot 20}{{c}^{2}}, \frac{{c}^{2}}{{b}^{5}}\right)\right)\right), \frac{1}{b}\right)\right)}\\
\end{array}
\end{array}
if b < 1.1499999999999999Initial program 85.7%
*-commutative85.7%
Simplified85.7%
add-cbrt-cube84.8%
pow1/381.6%
pow381.7%
pow281.7%
pow-pow81.7%
metadata-eval81.7%
Applied egg-rr81.7%
+-commutative81.7%
add-cube-cbrt81.1%
fma-define81.2%
Applied egg-rr83.1%
clear-num83.1%
inv-pow83.1%
fmm-undef83.3%
cbrt-prod83.8%
add-sqr-sqrt83.4%
add-cbrt-cube85.6%
Applied egg-rr85.6%
unpow-185.6%
Simplified85.6%
flip3--86.0%
pow1/286.0%
pow-pow86.5%
metadata-eval86.5%
add-sqr-sqrt86.5%
fma-define86.5%
Applied egg-rr86.5%
unpow286.5%
fmm-undef86.8%
distribute-rgt-neg-in86.8%
distribute-rgt-neg-in86.8%
metadata-eval86.8%
unpow286.8%
fmm-undef86.9%
distribute-rgt-neg-in86.9%
distribute-rgt-neg-in86.9%
metadata-eval86.9%
Simplified86.9%
if 1.1499999999999999 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
add-cbrt-cube48.1%
pow1/345.8%
pow345.8%
pow245.8%
pow-pow45.9%
metadata-eval45.9%
Applied egg-rr45.9%
+-commutative45.9%
add-cube-cbrt46.0%
fma-define45.9%
Applied egg-rr46.9%
clear-num46.9%
inv-pow46.9%
fmm-undef46.6%
cbrt-prod47.8%
add-sqr-sqrt47.4%
add-cbrt-cube48.6%
Applied egg-rr48.6%
unpow-148.6%
Simplified48.6%
Taylor expanded in a around 0 95.0%
Simplified95.0%
Final simplification93.7%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma b b (* c (* a -4.0)))) (t_1 (/ (pow c 4.0) (pow b 6.0))))
(if (<= b 1.15)
(/
-1.0
(/
(* a 2.0)
(/ (- (pow b 3.0) (pow t_0 1.5)) (+ t_0 (fma b b (* b (sqrt t_0)))))))
(-
(*
a
(-
(*
a
(+
(* -2.0 (/ (pow c 3.0) (pow b 5.0)))
(* -0.25 (/ (* a (+ (* 4.0 t_1) (* t_1 16.0))) b))))
(/ (pow c 2.0) (pow b 3.0))))
(/ c b)))))
double code(double a, double b, double c) {
double t_0 = fma(b, b, (c * (a * -4.0)));
double t_1 = pow(c, 4.0) / pow(b, 6.0);
double tmp;
if (b <= 1.15) {
tmp = -1.0 / ((a * 2.0) / ((pow(b, 3.0) - pow(t_0, 1.5)) / (t_0 + fma(b, b, (b * sqrt(t_0))))));
} else {
tmp = (a * ((a * ((-2.0 * (pow(c, 3.0) / pow(b, 5.0))) + (-0.25 * ((a * ((4.0 * t_1) + (t_1 * 16.0))) / b)))) - (pow(c, 2.0) / pow(b, 3.0)))) - (c / b);
}
return tmp;
}
function code(a, b, c) t_0 = fma(b, b, Float64(c * Float64(a * -4.0))) t_1 = Float64((c ^ 4.0) / (b ^ 6.0)) tmp = 0.0 if (b <= 1.15) tmp = Float64(-1.0 / Float64(Float64(a * 2.0) / Float64(Float64((b ^ 3.0) - (t_0 ^ 1.5)) / Float64(t_0 + fma(b, b, Float64(b * sqrt(t_0))))))); else tmp = Float64(Float64(a * Float64(Float64(a * Float64(Float64(-2.0 * Float64((c ^ 3.0) / (b ^ 5.0))) + Float64(-0.25 * Float64(Float64(a * Float64(Float64(4.0 * t_1) + Float64(t_1 * 16.0))) / b)))) - Float64((c ^ 2.0) / (b ^ 3.0)))) - Float64(c / b)); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[c, 4.0], $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.15], N[(-1.0 / N[(N[(a * 2.0), $MachinePrecision] / N[(N[(N[Power[b, 3.0], $MachinePrecision] - N[Power[t$95$0, 1.5], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(b * b + N[(b * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[(a * N[(N[(-2.0 * N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.25 * N[(N[(a * N[(N[(4.0 * t$95$1), $MachinePrecision] + N[(t$95$1 * 16.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\\
t_1 := \frac{{c}^{4}}{{b}^{6}}\\
\mathbf{if}\;b \leq 1.15:\\
\;\;\;\;\frac{-1}{\frac{a \cdot 2}{\frac{{b}^{3} - {t\_0}^{1.5}}{t\_0 + \mathsf{fma}\left(b, b, b \cdot \sqrt{t\_0}\right)}}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(a \cdot \left(-2 \cdot \frac{{c}^{3}}{{b}^{5}} + -0.25 \cdot \frac{a \cdot \left(4 \cdot t\_1 + t\_1 \cdot 16\right)}{b}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}\\
\end{array}
\end{array}
if b < 1.1499999999999999Initial program 85.7%
*-commutative85.7%
Simplified85.7%
add-cbrt-cube84.8%
pow1/381.6%
pow381.7%
pow281.7%
pow-pow81.7%
metadata-eval81.7%
Applied egg-rr81.7%
+-commutative81.7%
add-cube-cbrt81.1%
fma-define81.2%
Applied egg-rr83.1%
clear-num83.1%
inv-pow83.1%
fmm-undef83.3%
cbrt-prod83.8%
add-sqr-sqrt83.4%
add-cbrt-cube85.6%
Applied egg-rr85.6%
unpow-185.6%
Simplified85.6%
flip3--86.0%
pow1/286.0%
pow-pow86.5%
metadata-eval86.5%
add-sqr-sqrt86.5%
fma-define86.5%
Applied egg-rr86.5%
unpow286.5%
fmm-undef86.8%
distribute-rgt-neg-in86.8%
distribute-rgt-neg-in86.8%
metadata-eval86.8%
unpow286.8%
fmm-undef86.9%
distribute-rgt-neg-in86.9%
distribute-rgt-neg-in86.9%
metadata-eval86.9%
Simplified86.9%
if 1.1499999999999999 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
Taylor expanded in a around 0 94.9%
Final simplification93.6%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma b b (* c (* a -4.0)))))
(if (<= b 1.5)
(/
-1.0
(/
(* a 2.0)
(/ (- (pow b 3.0) (pow t_0 1.5)) (+ t_0 (fma b b (* b (sqrt t_0)))))))
(/
(-
(* -2.0 (* (* a a) (* (pow c 3.0) (pow b -4.0))))
(+
c
(-
(* a (* (pow c 2.0) (pow b -2.0)))
(* -0.25 (* (/ (pow (* a c) 4.0) a) (* 20.0 (pow b -6.0)))))))
b))))
double code(double a, double b, double c) {
double t_0 = fma(b, b, (c * (a * -4.0)));
double tmp;
if (b <= 1.5) {
tmp = -1.0 / ((a * 2.0) / ((pow(b, 3.0) - pow(t_0, 1.5)) / (t_0 + fma(b, b, (b * sqrt(t_0))))));
} else {
tmp = ((-2.0 * ((a * a) * (pow(c, 3.0) * pow(b, -4.0)))) - (c + ((a * (pow(c, 2.0) * pow(b, -2.0))) - (-0.25 * ((pow((a * c), 4.0) / a) * (20.0 * pow(b, -6.0))))))) / b;
}
return tmp;
}
function code(a, b, c) t_0 = fma(b, b, Float64(c * Float64(a * -4.0))) tmp = 0.0 if (b <= 1.5) tmp = Float64(-1.0 / Float64(Float64(a * 2.0) / Float64(Float64((b ^ 3.0) - (t_0 ^ 1.5)) / Float64(t_0 + fma(b, b, Float64(b * sqrt(t_0))))))); else tmp = Float64(Float64(Float64(-2.0 * Float64(Float64(a * a) * Float64((c ^ 3.0) * (b ^ -4.0)))) - Float64(c + Float64(Float64(a * Float64((c ^ 2.0) * (b ^ -2.0))) - Float64(-0.25 * Float64(Float64((Float64(a * c) ^ 4.0) / a) * Float64(20.0 * (b ^ -6.0))))))) / b); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.5], N[(-1.0 / N[(N[(a * 2.0), $MachinePrecision] / N[(N[(N[Power[b, 3.0], $MachinePrecision] - N[Power[t$95$0, 1.5], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(b * b + N[(b * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 * N[(N[(a * a), $MachinePrecision] * N[(N[Power[c, 3.0], $MachinePrecision] * N[Power[b, -4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c + N[(N[(a * N[(N[Power[c, 2.0], $MachinePrecision] * N[Power[b, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-0.25 * N[(N[(N[Power[N[(a * c), $MachinePrecision], 4.0], $MachinePrecision] / a), $MachinePrecision] * N[(20.0 * N[Power[b, -6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\\
\mathbf{if}\;b \leq 1.5:\\
\;\;\;\;\frac{-1}{\frac{a \cdot 2}{\frac{{b}^{3} - {t\_0}^{1.5}}{t\_0 + \mathsf{fma}\left(b, b, b \cdot \sqrt{t\_0}\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \left(\left(a \cdot a\right) \cdot \left({c}^{3} \cdot {b}^{-4}\right)\right) - \left(c + \left(a \cdot \left({c}^{2} \cdot {b}^{-2}\right) - -0.25 \cdot \left(\frac{{\left(a \cdot c\right)}^{4}}{a} \cdot \left(20 \cdot {b}^{-6}\right)\right)\right)\right)}{b}\\
\end{array}
\end{array}
if b < 1.5Initial program 85.7%
*-commutative85.7%
Simplified85.7%
add-cbrt-cube84.8%
pow1/381.6%
pow381.7%
pow281.7%
pow-pow81.7%
metadata-eval81.7%
Applied egg-rr81.7%
+-commutative81.7%
add-cube-cbrt81.1%
fma-define81.2%
Applied egg-rr83.1%
clear-num83.1%
inv-pow83.1%
fmm-undef83.3%
cbrt-prod83.8%
add-sqr-sqrt83.4%
add-cbrt-cube85.6%
Applied egg-rr85.6%
unpow-185.6%
Simplified85.6%
flip3--86.0%
pow1/286.0%
pow-pow86.5%
metadata-eval86.5%
add-sqr-sqrt86.5%
fma-define86.5%
Applied egg-rr86.5%
unpow286.5%
fmm-undef86.8%
distribute-rgt-neg-in86.8%
distribute-rgt-neg-in86.8%
metadata-eval86.8%
unpow286.8%
fmm-undef86.9%
distribute-rgt-neg-in86.9%
distribute-rgt-neg-in86.9%
metadata-eval86.9%
Simplified86.9%
if 1.5 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
Taylor expanded in b around inf 94.9%
Simplified94.9%
Applied egg-rr94.9%
unpow294.9%
Applied egg-rr94.9%
Final simplification93.6%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (- (pow b 2.0) (* c (* a 4.0)))))
(if (<= b 1.2)
(/ (/ (- t_0 (pow (- b) 2.0)) (+ b (sqrt t_0))) (* a 2.0))
(/
(-
(* -2.0 (* (* a a) (* (pow c 3.0) (pow b -4.0))))
(+
c
(-
(* a (* (pow c 2.0) (pow b -2.0)))
(* -0.25 (* (/ (pow (* a c) 4.0) a) (* 20.0 (pow b -6.0)))))))
b))))
double code(double a, double b, double c) {
double t_0 = pow(b, 2.0) - (c * (a * 4.0));
double tmp;
if (b <= 1.2) {
tmp = ((t_0 - pow(-b, 2.0)) / (b + sqrt(t_0))) / (a * 2.0);
} else {
tmp = ((-2.0 * ((a * a) * (pow(c, 3.0) * pow(b, -4.0)))) - (c + ((a * (pow(c, 2.0) * pow(b, -2.0))) - (-0.25 * ((pow((a * c), 4.0) / a) * (20.0 * pow(b, -6.0))))))) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = (b ** 2.0d0) - (c * (a * 4.0d0))
if (b <= 1.2d0) then
tmp = ((t_0 - (-b ** 2.0d0)) / (b + sqrt(t_0))) / (a * 2.0d0)
else
tmp = (((-2.0d0) * ((a * a) * ((c ** 3.0d0) * (b ** (-4.0d0))))) - (c + ((a * ((c ** 2.0d0) * (b ** (-2.0d0)))) - ((-0.25d0) * ((((a * c) ** 4.0d0) / a) * (20.0d0 * (b ** (-6.0d0)))))))) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.pow(b, 2.0) - (c * (a * 4.0));
double tmp;
if (b <= 1.2) {
tmp = ((t_0 - Math.pow(-b, 2.0)) / (b + Math.sqrt(t_0))) / (a * 2.0);
} else {
tmp = ((-2.0 * ((a * a) * (Math.pow(c, 3.0) * Math.pow(b, -4.0)))) - (c + ((a * (Math.pow(c, 2.0) * Math.pow(b, -2.0))) - (-0.25 * ((Math.pow((a * c), 4.0) / a) * (20.0 * Math.pow(b, -6.0))))))) / b;
}
return tmp;
}
def code(a, b, c): t_0 = math.pow(b, 2.0) - (c * (a * 4.0)) tmp = 0 if b <= 1.2: tmp = ((t_0 - math.pow(-b, 2.0)) / (b + math.sqrt(t_0))) / (a * 2.0) else: tmp = ((-2.0 * ((a * a) * (math.pow(c, 3.0) * math.pow(b, -4.0)))) - (c + ((a * (math.pow(c, 2.0) * math.pow(b, -2.0))) - (-0.25 * ((math.pow((a * c), 4.0) / a) * (20.0 * math.pow(b, -6.0))))))) / b return tmp
function code(a, b, c) t_0 = Float64((b ^ 2.0) - Float64(c * Float64(a * 4.0))) tmp = 0.0 if (b <= 1.2) tmp = Float64(Float64(Float64(t_0 - (Float64(-b) ^ 2.0)) / Float64(b + sqrt(t_0))) / Float64(a * 2.0)); else tmp = Float64(Float64(Float64(-2.0 * Float64(Float64(a * a) * Float64((c ^ 3.0) * (b ^ -4.0)))) - Float64(c + Float64(Float64(a * Float64((c ^ 2.0) * (b ^ -2.0))) - Float64(-0.25 * Float64(Float64((Float64(a * c) ^ 4.0) / a) * Float64(20.0 * (b ^ -6.0))))))) / b); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (b ^ 2.0) - (c * (a * 4.0)); tmp = 0.0; if (b <= 1.2) tmp = ((t_0 - (-b ^ 2.0)) / (b + sqrt(t_0))) / (a * 2.0); else tmp = ((-2.0 * ((a * a) * ((c ^ 3.0) * (b ^ -4.0)))) - (c + ((a * ((c ^ 2.0) * (b ^ -2.0))) - (-0.25 * ((((a * c) ^ 4.0) / a) * (20.0 * (b ^ -6.0))))))) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Power[b, 2.0], $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.2], N[(N[(N[(t$95$0 - N[Power[(-b), 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 * N[(N[(a * a), $MachinePrecision] * N[(N[Power[c, 3.0], $MachinePrecision] * N[Power[b, -4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c + N[(N[(a * N[(N[Power[c, 2.0], $MachinePrecision] * N[Power[b, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-0.25 * N[(N[(N[Power[N[(a * c), $MachinePrecision], 4.0], $MachinePrecision] / a), $MachinePrecision] * N[(20.0 * N[Power[b, -6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {b}^{2} - c \cdot \left(a \cdot 4\right)\\
\mathbf{if}\;b \leq 1.2:\\
\;\;\;\;\frac{\frac{t\_0 - {\left(-b\right)}^{2}}{b + \sqrt{t\_0}}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \left(\left(a \cdot a\right) \cdot \left({c}^{3} \cdot {b}^{-4}\right)\right) - \left(c + \left(a \cdot \left({c}^{2} \cdot {b}^{-2}\right) - -0.25 \cdot \left(\frac{{\left(a \cdot c\right)}^{4}}{a} \cdot \left(20 \cdot {b}^{-6}\right)\right)\right)\right)}{b}\\
\end{array}
\end{array}
if b < 1.19999999999999996Initial program 85.7%
*-commutative85.7%
Simplified85.7%
add-cbrt-cube84.8%
pow1/381.6%
pow381.7%
pow281.7%
pow-pow81.7%
metadata-eval81.7%
Applied egg-rr81.7%
flip-+81.7%
pow281.7%
pow-pow82.8%
metadata-eval82.8%
pow-pow85.1%
metadata-eval85.1%
add-sqr-sqrt85.8%
*-commutative85.8%
*-commutative85.8%
Applied egg-rr86.1%
if 1.19999999999999996 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
Taylor expanded in b around inf 94.9%
Simplified94.9%
Applied egg-rr94.9%
unpow294.9%
Applied egg-rr94.9%
Final simplification93.5%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (- (pow b 2.0) (* c (* a 4.0)))))
(if (<= b 1.15)
(/ (/ (- t_0 (pow (- b) 2.0)) (+ b (sqrt t_0))) (* a 2.0))
(/
(-
(*
a
(-
(*
a
(+
(* -5.0 (/ (* a (pow c 4.0)) (pow b 6.0)))
(* -2.0 (/ (pow c 3.0) (pow b 4.0)))))
(/ (pow c 2.0) (pow b 2.0))))
c)
b))))
double code(double a, double b, double c) {
double t_0 = pow(b, 2.0) - (c * (a * 4.0));
double tmp;
if (b <= 1.15) {
tmp = ((t_0 - pow(-b, 2.0)) / (b + sqrt(t_0))) / (a * 2.0);
} else {
tmp = ((a * ((a * ((-5.0 * ((a * pow(c, 4.0)) / pow(b, 6.0))) + (-2.0 * (pow(c, 3.0) / pow(b, 4.0))))) - (pow(c, 2.0) / pow(b, 2.0)))) - c) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = (b ** 2.0d0) - (c * (a * 4.0d0))
if (b <= 1.15d0) then
tmp = ((t_0 - (-b ** 2.0d0)) / (b + sqrt(t_0))) / (a * 2.0d0)
else
tmp = ((a * ((a * (((-5.0d0) * ((a * (c ** 4.0d0)) / (b ** 6.0d0))) + ((-2.0d0) * ((c ** 3.0d0) / (b ** 4.0d0))))) - ((c ** 2.0d0) / (b ** 2.0d0)))) - c) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.pow(b, 2.0) - (c * (a * 4.0));
double tmp;
if (b <= 1.15) {
tmp = ((t_0 - Math.pow(-b, 2.0)) / (b + Math.sqrt(t_0))) / (a * 2.0);
} else {
tmp = ((a * ((a * ((-5.0 * ((a * Math.pow(c, 4.0)) / Math.pow(b, 6.0))) + (-2.0 * (Math.pow(c, 3.0) / Math.pow(b, 4.0))))) - (Math.pow(c, 2.0) / Math.pow(b, 2.0)))) - c) / b;
}
return tmp;
}
def code(a, b, c): t_0 = math.pow(b, 2.0) - (c * (a * 4.0)) tmp = 0 if b <= 1.15: tmp = ((t_0 - math.pow(-b, 2.0)) / (b + math.sqrt(t_0))) / (a * 2.0) else: tmp = ((a * ((a * ((-5.0 * ((a * math.pow(c, 4.0)) / math.pow(b, 6.0))) + (-2.0 * (math.pow(c, 3.0) / math.pow(b, 4.0))))) - (math.pow(c, 2.0) / math.pow(b, 2.0)))) - c) / b return tmp
function code(a, b, c) t_0 = Float64((b ^ 2.0) - Float64(c * Float64(a * 4.0))) tmp = 0.0 if (b <= 1.15) tmp = Float64(Float64(Float64(t_0 - (Float64(-b) ^ 2.0)) / Float64(b + sqrt(t_0))) / Float64(a * 2.0)); else tmp = Float64(Float64(Float64(a * Float64(Float64(a * Float64(Float64(-5.0 * Float64(Float64(a * (c ^ 4.0)) / (b ^ 6.0))) + Float64(-2.0 * Float64((c ^ 3.0) / (b ^ 4.0))))) - Float64((c ^ 2.0) / (b ^ 2.0)))) - c) / b); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (b ^ 2.0) - (c * (a * 4.0)); tmp = 0.0; if (b <= 1.15) tmp = ((t_0 - (-b ^ 2.0)) / (b + sqrt(t_0))) / (a * 2.0); else tmp = ((a * ((a * ((-5.0 * ((a * (c ^ 4.0)) / (b ^ 6.0))) + (-2.0 * ((c ^ 3.0) / (b ^ 4.0))))) - ((c ^ 2.0) / (b ^ 2.0)))) - c) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Power[b, 2.0], $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.15], N[(N[(N[(t$95$0 - N[Power[(-b), 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * N[(N[(a * N[(N[(-5.0 * N[(N[(a * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - c), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {b}^{2} - c \cdot \left(a \cdot 4\right)\\
\mathbf{if}\;b \leq 1.15:\\
\;\;\;\;\frac{\frac{t\_0 - {\left(-b\right)}^{2}}{b + \sqrt{t\_0}}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot {c}^{4}}{{b}^{6}} + -2 \cdot \frac{{c}^{3}}{{b}^{4}}\right) - \frac{{c}^{2}}{{b}^{2}}\right) - c}{b}\\
\end{array}
\end{array}
if b < 1.1499999999999999Initial program 85.7%
*-commutative85.7%
Simplified85.7%
add-cbrt-cube84.8%
pow1/381.6%
pow381.7%
pow281.7%
pow-pow81.7%
metadata-eval81.7%
Applied egg-rr81.7%
flip-+81.7%
pow281.7%
pow-pow82.8%
metadata-eval82.8%
pow-pow85.1%
metadata-eval85.1%
add-sqr-sqrt85.8%
*-commutative85.8%
*-commutative85.8%
Applied egg-rr86.1%
if 1.1499999999999999 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
Taylor expanded in b around inf 94.9%
Simplified94.9%
Applied egg-rr94.9%
unpow294.9%
Applied egg-rr94.9%
Taylor expanded in a around 0 94.9%
Final simplification93.5%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (- (pow b 2.0) (* c (* a 4.0)))))
(if (<= b 1.15)
(/ (/ (- t_0 (pow (- b) 2.0)) (+ b (sqrt t_0))) (* a 2.0))
(/
(*
c
(+
-1.0
(*
c
(-
(*
c
(+
(* -5.0 (/ (* c (pow a 3.0)) (pow b 6.0)))
(* -2.0 (/ (pow a 2.0) (pow b 4.0)))))
(/ a (pow b 2.0))))))
b))))
double code(double a, double b, double c) {
double t_0 = pow(b, 2.0) - (c * (a * 4.0));
double tmp;
if (b <= 1.15) {
tmp = ((t_0 - pow(-b, 2.0)) / (b + sqrt(t_0))) / (a * 2.0);
} else {
tmp = (c * (-1.0 + (c * ((c * ((-5.0 * ((c * pow(a, 3.0)) / pow(b, 6.0))) + (-2.0 * (pow(a, 2.0) / pow(b, 4.0))))) - (a / pow(b, 2.0)))))) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = (b ** 2.0d0) - (c * (a * 4.0d0))
if (b <= 1.15d0) then
tmp = ((t_0 - (-b ** 2.0d0)) / (b + sqrt(t_0))) / (a * 2.0d0)
else
tmp = (c * ((-1.0d0) + (c * ((c * (((-5.0d0) * ((c * (a ** 3.0d0)) / (b ** 6.0d0))) + ((-2.0d0) * ((a ** 2.0d0) / (b ** 4.0d0))))) - (a / (b ** 2.0d0)))))) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.pow(b, 2.0) - (c * (a * 4.0));
double tmp;
if (b <= 1.15) {
tmp = ((t_0 - Math.pow(-b, 2.0)) / (b + Math.sqrt(t_0))) / (a * 2.0);
} else {
tmp = (c * (-1.0 + (c * ((c * ((-5.0 * ((c * Math.pow(a, 3.0)) / Math.pow(b, 6.0))) + (-2.0 * (Math.pow(a, 2.0) / Math.pow(b, 4.0))))) - (a / Math.pow(b, 2.0)))))) / b;
}
return tmp;
}
def code(a, b, c): t_0 = math.pow(b, 2.0) - (c * (a * 4.0)) tmp = 0 if b <= 1.15: tmp = ((t_0 - math.pow(-b, 2.0)) / (b + math.sqrt(t_0))) / (a * 2.0) else: tmp = (c * (-1.0 + (c * ((c * ((-5.0 * ((c * math.pow(a, 3.0)) / math.pow(b, 6.0))) + (-2.0 * (math.pow(a, 2.0) / math.pow(b, 4.0))))) - (a / math.pow(b, 2.0)))))) / b return tmp
function code(a, b, c) t_0 = Float64((b ^ 2.0) - Float64(c * Float64(a * 4.0))) tmp = 0.0 if (b <= 1.15) tmp = Float64(Float64(Float64(t_0 - (Float64(-b) ^ 2.0)) / Float64(b + sqrt(t_0))) / Float64(a * 2.0)); else tmp = Float64(Float64(c * Float64(-1.0 + Float64(c * Float64(Float64(c * Float64(Float64(-5.0 * Float64(Float64(c * (a ^ 3.0)) / (b ^ 6.0))) + Float64(-2.0 * Float64((a ^ 2.0) / (b ^ 4.0))))) - Float64(a / (b ^ 2.0)))))) / b); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (b ^ 2.0) - (c * (a * 4.0)); tmp = 0.0; if (b <= 1.15) tmp = ((t_0 - (-b ^ 2.0)) / (b + sqrt(t_0))) / (a * 2.0); else tmp = (c * (-1.0 + (c * ((c * ((-5.0 * ((c * (a ^ 3.0)) / (b ^ 6.0))) + (-2.0 * ((a ^ 2.0) / (b ^ 4.0))))) - (a / (b ^ 2.0)))))) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Power[b, 2.0], $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.15], N[(N[(N[(t$95$0 - N[Power[(-b), 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * N[(-1.0 + N[(c * N[(N[(c * N[(N[(-5.0 * N[(N[(c * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(N[Power[a, 2.0], $MachinePrecision] / N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {b}^{2} - c \cdot \left(a \cdot 4\right)\\
\mathbf{if}\;b \leq 1.15:\\
\;\;\;\;\frac{\frac{t\_0 - {\left(-b\right)}^{2}}{b + \sqrt{t\_0}}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot \left(-1 + c \cdot \left(c \cdot \left(-5 \cdot \frac{c \cdot {a}^{3}}{{b}^{6}} + -2 \cdot \frac{{a}^{2}}{{b}^{4}}\right) - \frac{a}{{b}^{2}}\right)\right)}{b}\\
\end{array}
\end{array}
if b < 1.1499999999999999Initial program 85.7%
*-commutative85.7%
Simplified85.7%
add-cbrt-cube84.8%
pow1/381.6%
pow381.7%
pow281.7%
pow-pow81.7%
metadata-eval81.7%
Applied egg-rr81.7%
flip-+81.7%
pow281.7%
pow-pow82.8%
metadata-eval82.8%
pow-pow85.1%
metadata-eval85.1%
add-sqr-sqrt85.8%
*-commutative85.8%
*-commutative85.8%
Applied egg-rr86.1%
if 1.1499999999999999 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
Taylor expanded in b around inf 94.9%
Simplified94.9%
Applied egg-rr94.9%
unpow294.9%
Applied egg-rr94.9%
Taylor expanded in c around 0 94.8%
Final simplification93.4%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ c (pow b 3.0))) (t_1 (- (pow b 2.0) (* c (* a 4.0)))))
(if (<= b 1.4)
(/ 1.0 (/ (* a 2.0) (/ (- t_1 (pow b 2.0)) (+ b (sqrt t_1)))))
(/
-1.0
(+ (/ b c) (* a (+ (* -2.0 (* a (- t_0 (* t_0 0.5)))) (/ -1.0 b))))))))
double code(double a, double b, double c) {
double t_0 = c / pow(b, 3.0);
double t_1 = pow(b, 2.0) - (c * (a * 4.0));
double tmp;
if (b <= 1.4) {
tmp = 1.0 / ((a * 2.0) / ((t_1 - pow(b, 2.0)) / (b + sqrt(t_1))));
} else {
tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b))));
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = c / (b ** 3.0d0)
t_1 = (b ** 2.0d0) - (c * (a * 4.0d0))
if (b <= 1.4d0) then
tmp = 1.0d0 / ((a * 2.0d0) / ((t_1 - (b ** 2.0d0)) / (b + sqrt(t_1))))
else
tmp = (-1.0d0) / ((b / c) + (a * (((-2.0d0) * (a * (t_0 - (t_0 * 0.5d0)))) + ((-1.0d0) / b))))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = c / Math.pow(b, 3.0);
double t_1 = Math.pow(b, 2.0) - (c * (a * 4.0));
double tmp;
if (b <= 1.4) {
tmp = 1.0 / ((a * 2.0) / ((t_1 - Math.pow(b, 2.0)) / (b + Math.sqrt(t_1))));
} else {
tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b))));
}
return tmp;
}
def code(a, b, c): t_0 = c / math.pow(b, 3.0) t_1 = math.pow(b, 2.0) - (c * (a * 4.0)) tmp = 0 if b <= 1.4: tmp = 1.0 / ((a * 2.0) / ((t_1 - math.pow(b, 2.0)) / (b + math.sqrt(t_1)))) else: tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b)))) return tmp
function code(a, b, c) t_0 = Float64(c / (b ^ 3.0)) t_1 = Float64((b ^ 2.0) - Float64(c * Float64(a * 4.0))) tmp = 0.0 if (b <= 1.4) tmp = Float64(1.0 / Float64(Float64(a * 2.0) / Float64(Float64(t_1 - (b ^ 2.0)) / Float64(b + sqrt(t_1))))); else tmp = Float64(-1.0 / Float64(Float64(b / c) + Float64(a * Float64(Float64(-2.0 * Float64(a * Float64(t_0 - Float64(t_0 * 0.5)))) + Float64(-1.0 / b))))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = c / (b ^ 3.0); t_1 = (b ^ 2.0) - (c * (a * 4.0)); tmp = 0.0; if (b <= 1.4) tmp = 1.0 / ((a * 2.0) / ((t_1 - (b ^ 2.0)) / (b + sqrt(t_1)))); else tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b)))); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[b, 2.0], $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.4], N[(1.0 / N[(N[(a * 2.0), $MachinePrecision] / N[(N[(t$95$1 - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(N[(b / c), $MachinePrecision] + N[(a * N[(N[(-2.0 * N[(a * N[(t$95$0 - N[(t$95$0 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c}{{b}^{3}}\\
t_1 := {b}^{2} - c \cdot \left(a \cdot 4\right)\\
\mathbf{if}\;b \leq 1.4:\\
\;\;\;\;\frac{1}{\frac{a \cdot 2}{\frac{t\_1 - {b}^{2}}{b + \sqrt{t\_1}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{b}{c} + a \cdot \left(-2 \cdot \left(a \cdot \left(t\_0 - t\_0 \cdot 0.5\right)\right) + \frac{-1}{b}\right)}\\
\end{array}
\end{array}
if b < 1.3999999999999999Initial program 85.7%
*-commutative85.7%
Simplified85.7%
add-cbrt-cube84.8%
pow1/381.6%
pow381.7%
pow281.7%
pow-pow81.7%
metadata-eval81.7%
Applied egg-rr81.7%
+-commutative81.7%
add-cube-cbrt81.1%
fma-define81.2%
Applied egg-rr83.1%
clear-num83.1%
inv-pow83.1%
fmm-undef83.3%
cbrt-prod83.8%
add-sqr-sqrt83.4%
add-cbrt-cube85.6%
Applied egg-rr85.6%
unpow-185.6%
Simplified85.6%
flip--85.4%
add-sqr-sqrt86.1%
unpow286.1%
Applied egg-rr86.1%
if 1.3999999999999999 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
add-cbrt-cube48.1%
pow1/345.8%
pow345.8%
pow245.8%
pow-pow45.9%
metadata-eval45.9%
Applied egg-rr45.9%
+-commutative45.9%
add-cube-cbrt46.0%
fma-define45.9%
Applied egg-rr46.9%
clear-num46.9%
inv-pow46.9%
fmm-undef46.6%
cbrt-prod47.8%
add-sqr-sqrt47.4%
add-cbrt-cube48.6%
Applied egg-rr48.6%
unpow-148.6%
Simplified48.6%
Taylor expanded in a around 0 92.9%
Final simplification91.9%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ c (pow b 3.0))) (t_1 (- (pow b 2.0) (* c (* a 4.0)))))
(if (<= b 1.65)
(/ (/ (- t_1 (pow (- b) 2.0)) (+ b (sqrt t_1))) (* a 2.0))
(/
-1.0
(+ (/ b c) (* a (+ (* -2.0 (* a (- t_0 (* t_0 0.5)))) (/ -1.0 b))))))))
double code(double a, double b, double c) {
double t_0 = c / pow(b, 3.0);
double t_1 = pow(b, 2.0) - (c * (a * 4.0));
double tmp;
if (b <= 1.65) {
tmp = ((t_1 - pow(-b, 2.0)) / (b + sqrt(t_1))) / (a * 2.0);
} else {
tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b))));
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = c / (b ** 3.0d0)
t_1 = (b ** 2.0d0) - (c * (a * 4.0d0))
if (b <= 1.65d0) then
tmp = ((t_1 - (-b ** 2.0d0)) / (b + sqrt(t_1))) / (a * 2.0d0)
else
tmp = (-1.0d0) / ((b / c) + (a * (((-2.0d0) * (a * (t_0 - (t_0 * 0.5d0)))) + ((-1.0d0) / b))))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = c / Math.pow(b, 3.0);
double t_1 = Math.pow(b, 2.0) - (c * (a * 4.0));
double tmp;
if (b <= 1.65) {
tmp = ((t_1 - Math.pow(-b, 2.0)) / (b + Math.sqrt(t_1))) / (a * 2.0);
} else {
tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b))));
}
return tmp;
}
def code(a, b, c): t_0 = c / math.pow(b, 3.0) t_1 = math.pow(b, 2.0) - (c * (a * 4.0)) tmp = 0 if b <= 1.65: tmp = ((t_1 - math.pow(-b, 2.0)) / (b + math.sqrt(t_1))) / (a * 2.0) else: tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b)))) return tmp
function code(a, b, c) t_0 = Float64(c / (b ^ 3.0)) t_1 = Float64((b ^ 2.0) - Float64(c * Float64(a * 4.0))) tmp = 0.0 if (b <= 1.65) tmp = Float64(Float64(Float64(t_1 - (Float64(-b) ^ 2.0)) / Float64(b + sqrt(t_1))) / Float64(a * 2.0)); else tmp = Float64(-1.0 / Float64(Float64(b / c) + Float64(a * Float64(Float64(-2.0 * Float64(a * Float64(t_0 - Float64(t_0 * 0.5)))) + Float64(-1.0 / b))))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = c / (b ^ 3.0); t_1 = (b ^ 2.0) - (c * (a * 4.0)); tmp = 0.0; if (b <= 1.65) tmp = ((t_1 - (-b ^ 2.0)) / (b + sqrt(t_1))) / (a * 2.0); else tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b)))); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[b, 2.0], $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.65], N[(N[(N[(t$95$1 - N[Power[(-b), 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(N[(b / c), $MachinePrecision] + N[(a * N[(N[(-2.0 * N[(a * N[(t$95$0 - N[(t$95$0 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c}{{b}^{3}}\\
t_1 := {b}^{2} - c \cdot \left(a \cdot 4\right)\\
\mathbf{if}\;b \leq 1.65:\\
\;\;\;\;\frac{\frac{t\_1 - {\left(-b\right)}^{2}}{b + \sqrt{t\_1}}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{b}{c} + a \cdot \left(-2 \cdot \left(a \cdot \left(t\_0 - t\_0 \cdot 0.5\right)\right) + \frac{-1}{b}\right)}\\
\end{array}
\end{array}
if b < 1.6499999999999999Initial program 85.7%
*-commutative85.7%
Simplified85.7%
add-cbrt-cube84.8%
pow1/381.6%
pow381.7%
pow281.7%
pow-pow81.7%
metadata-eval81.7%
Applied egg-rr81.7%
flip-+81.7%
pow281.7%
pow-pow82.8%
metadata-eval82.8%
pow-pow85.1%
metadata-eval85.1%
add-sqr-sqrt85.8%
*-commutative85.8%
*-commutative85.8%
Applied egg-rr86.1%
if 1.6499999999999999 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
add-cbrt-cube48.1%
pow1/345.8%
pow345.8%
pow245.8%
pow-pow45.9%
metadata-eval45.9%
Applied egg-rr45.9%
+-commutative45.9%
add-cube-cbrt46.0%
fma-define45.9%
Applied egg-rr46.9%
clear-num46.9%
inv-pow46.9%
fmm-undef46.6%
cbrt-prod47.8%
add-sqr-sqrt47.4%
add-cbrt-cube48.6%
Applied egg-rr48.6%
unpow-148.6%
Simplified48.6%
Taylor expanded in a around 0 92.9%
Final simplification91.9%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ c (pow b 3.0))) (t_1 (fma b b (* c (* a -4.0)))))
(if (<= b 1.15)
(/ 1.0 (/ (* a 2.0) (/ (- t_1 (pow b 2.0)) (+ b (sqrt t_1)))))
(/
-1.0
(+ (/ b c) (* a (+ (* -2.0 (* a (- t_0 (* t_0 0.5)))) (/ -1.0 b))))))))
double code(double a, double b, double c) {
double t_0 = c / pow(b, 3.0);
double t_1 = fma(b, b, (c * (a * -4.0)));
double tmp;
if (b <= 1.15) {
tmp = 1.0 / ((a * 2.0) / ((t_1 - pow(b, 2.0)) / (b + sqrt(t_1))));
} else {
tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b))));
}
return tmp;
}
function code(a, b, c) t_0 = Float64(c / (b ^ 3.0)) t_1 = fma(b, b, Float64(c * Float64(a * -4.0))) tmp = 0.0 if (b <= 1.15) tmp = Float64(1.0 / Float64(Float64(a * 2.0) / Float64(Float64(t_1 - (b ^ 2.0)) / Float64(b + sqrt(t_1))))); else tmp = Float64(-1.0 / Float64(Float64(b / c) + Float64(a * Float64(Float64(-2.0 * Float64(a * Float64(t_0 - Float64(t_0 * 0.5)))) + Float64(-1.0 / b))))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.15], N[(1.0 / N[(N[(a * 2.0), $MachinePrecision] / N[(N[(t$95$1 - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(N[(b / c), $MachinePrecision] + N[(a * N[(N[(-2.0 * N[(a * N[(t$95$0 - N[(t$95$0 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c}{{b}^{3}}\\
t_1 := \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\\
\mathbf{if}\;b \leq 1.15:\\
\;\;\;\;\frac{1}{\frac{a \cdot 2}{\frac{t\_1 - {b}^{2}}{b + \sqrt{t\_1}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{b}{c} + a \cdot \left(-2 \cdot \left(a \cdot \left(t\_0 - t\_0 \cdot 0.5\right)\right) + \frac{-1}{b}\right)}\\
\end{array}
\end{array}
if b < 1.1499999999999999Initial program 85.7%
*-commutative85.7%
Simplified85.7%
add-cbrt-cube84.8%
pow1/381.6%
pow381.7%
pow281.7%
pow-pow81.7%
metadata-eval81.7%
Applied egg-rr81.7%
+-commutative81.7%
add-cube-cbrt81.1%
fma-define81.2%
Applied egg-rr83.1%
clear-num83.1%
inv-pow83.1%
fmm-undef83.3%
cbrt-prod83.8%
add-sqr-sqrt83.4%
add-cbrt-cube85.6%
Applied egg-rr85.6%
unpow-185.6%
Simplified85.6%
flip--85.4%
add-sqr-sqrt86.1%
unpow286.1%
Applied egg-rr86.1%
unpow286.1%
fmm-undef86.0%
distribute-rgt-neg-in86.0%
distribute-rgt-neg-in86.0%
metadata-eval86.0%
+-commutative86.0%
unpow286.0%
fmm-undef85.8%
distribute-rgt-neg-in85.8%
distribute-rgt-neg-in85.8%
metadata-eval85.8%
Simplified85.8%
if 1.1499999999999999 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
add-cbrt-cube48.1%
pow1/345.8%
pow345.8%
pow245.8%
pow-pow45.9%
metadata-eval45.9%
Applied egg-rr45.9%
+-commutative45.9%
add-cube-cbrt46.0%
fma-define45.9%
Applied egg-rr46.9%
clear-num46.9%
inv-pow46.9%
fmm-undef46.6%
cbrt-prod47.8%
add-sqr-sqrt47.4%
add-cbrt-cube48.6%
Applied egg-rr48.6%
unpow-148.6%
Simplified48.6%
Taylor expanded in a around 0 92.9%
Final simplification91.8%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ c (pow b 3.0))))
(if (<= b 1.35)
(/
(cbrt (pow (- (sqrt (- (pow b 2.0) (* c (* a 4.0)))) b) 3.0))
(* a 2.0))
(/
-1.0
(+ (/ b c) (* a (+ (* -2.0 (* a (- t_0 (* t_0 0.5)))) (/ -1.0 b))))))))
double code(double a, double b, double c) {
double t_0 = c / pow(b, 3.0);
double tmp;
if (b <= 1.35) {
tmp = cbrt(pow((sqrt((pow(b, 2.0) - (c * (a * 4.0)))) - b), 3.0)) / (a * 2.0);
} else {
tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b))));
}
return tmp;
}
public static double code(double a, double b, double c) {
double t_0 = c / Math.pow(b, 3.0);
double tmp;
if (b <= 1.35) {
tmp = Math.cbrt(Math.pow((Math.sqrt((Math.pow(b, 2.0) - (c * (a * 4.0)))) - b), 3.0)) / (a * 2.0);
} else {
tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b))));
}
return tmp;
}
function code(a, b, c) t_0 = Float64(c / (b ^ 3.0)) tmp = 0.0 if (b <= 1.35) tmp = Float64(cbrt((Float64(sqrt(Float64((b ^ 2.0) - Float64(c * Float64(a * 4.0)))) - b) ^ 3.0)) / Float64(a * 2.0)); else tmp = Float64(-1.0 / Float64(Float64(b / c) + Float64(a * Float64(Float64(-2.0 * Float64(a * Float64(t_0 - Float64(t_0 * 0.5)))) + Float64(-1.0 / b))))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.35], N[(N[Power[N[Power[N[(N[Sqrt[N[(N[Power[b, 2.0], $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(N[(b / c), $MachinePrecision] + N[(a * N[(N[(-2.0 * N[(a * N[(t$95$0 - N[(t$95$0 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c}{{b}^{3}}\\
\mathbf{if}\;b \leq 1.35:\\
\;\;\;\;\frac{\sqrt[3]{{\left(\sqrt{{b}^{2} - c \cdot \left(a \cdot 4\right)} - b\right)}^{3}}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{b}{c} + a \cdot \left(-2 \cdot \left(a \cdot \left(t\_0 - t\_0 \cdot 0.5\right)\right) + \frac{-1}{b}\right)}\\
\end{array}
\end{array}
if b < 1.3500000000000001Initial program 85.7%
*-commutative85.7%
Simplified85.7%
add-cbrt-cube84.8%
pow1/381.6%
pow381.7%
pow281.7%
pow-pow81.7%
metadata-eval81.7%
Applied egg-rr81.7%
+-commutative81.7%
add-cube-cbrt81.1%
fma-define81.2%
Applied egg-rr83.1%
add-cbrt-cube83.1%
pow383.1%
Applied egg-rr85.7%
if 1.3500000000000001 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
add-cbrt-cube48.1%
pow1/345.8%
pow345.8%
pow245.8%
pow-pow45.9%
metadata-eval45.9%
Applied egg-rr45.9%
+-commutative45.9%
add-cube-cbrt46.0%
fma-define45.9%
Applied egg-rr46.9%
clear-num46.9%
inv-pow46.9%
fmm-undef46.6%
cbrt-prod47.8%
add-sqr-sqrt47.4%
add-cbrt-cube48.6%
Applied egg-rr48.6%
unpow-148.6%
Simplified48.6%
Taylor expanded in a around 0 92.9%
Final simplification91.8%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ c (pow b 3.0))))
(if (<= b 1.25)
(cbrt
(pow (/ (- (sqrt (- (pow b 2.0) (* c (* a 4.0)))) b) (* a 2.0)) 3.0))
(/
-1.0
(+ (/ b c) (* a (+ (* -2.0 (* a (- t_0 (* t_0 0.5)))) (/ -1.0 b))))))))
double code(double a, double b, double c) {
double t_0 = c / pow(b, 3.0);
double tmp;
if (b <= 1.25) {
tmp = cbrt(pow(((sqrt((pow(b, 2.0) - (c * (a * 4.0)))) - b) / (a * 2.0)), 3.0));
} else {
tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b))));
}
return tmp;
}
public static double code(double a, double b, double c) {
double t_0 = c / Math.pow(b, 3.0);
double tmp;
if (b <= 1.25) {
tmp = Math.cbrt(Math.pow(((Math.sqrt((Math.pow(b, 2.0) - (c * (a * 4.0)))) - b) / (a * 2.0)), 3.0));
} else {
tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b))));
}
return tmp;
}
function code(a, b, c) t_0 = Float64(c / (b ^ 3.0)) tmp = 0.0 if (b <= 1.25) tmp = cbrt((Float64(Float64(sqrt(Float64((b ^ 2.0) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) ^ 3.0)); else tmp = Float64(-1.0 / Float64(Float64(b / c) + Float64(a * Float64(Float64(-2.0 * Float64(a * Float64(t_0 - Float64(t_0 * 0.5)))) + Float64(-1.0 / b))))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.25], N[Power[N[Power[N[(N[(N[Sqrt[N[(N[Power[b, 2.0], $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision], N[(-1.0 / N[(N[(b / c), $MachinePrecision] + N[(a * N[(N[(-2.0 * N[(a * N[(t$95$0 - N[(t$95$0 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c}{{b}^{3}}\\
\mathbf{if}\;b \leq 1.25:\\
\;\;\;\;\sqrt[3]{{\left(\frac{\sqrt{{b}^{2} - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\right)}^{3}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{b}{c} + a \cdot \left(-2 \cdot \left(a \cdot \left(t\_0 - t\_0 \cdot 0.5\right)\right) + \frac{-1}{b}\right)}\\
\end{array}
\end{array}
if b < 1.25Initial program 85.7%
*-commutative85.7%
Simplified85.7%
add-cbrt-cube84.8%
pow1/381.6%
pow381.7%
pow281.7%
pow-pow81.7%
metadata-eval81.7%
Applied egg-rr81.7%
+-commutative81.7%
add-cube-cbrt81.1%
fma-define81.2%
Applied egg-rr83.1%
add-cbrt-cube83.1%
pow383.1%
Applied egg-rr85.7%
if 1.25 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
add-cbrt-cube48.1%
pow1/345.8%
pow345.8%
pow245.8%
pow-pow45.9%
metadata-eval45.9%
Applied egg-rr45.9%
+-commutative45.9%
add-cube-cbrt46.0%
fma-define45.9%
Applied egg-rr46.9%
clear-num46.9%
inv-pow46.9%
fmm-undef46.6%
cbrt-prod47.8%
add-sqr-sqrt47.4%
add-cbrt-cube48.6%
Applied egg-rr48.6%
unpow-148.6%
Simplified48.6%
Taylor expanded in a around 0 92.9%
Final simplification91.8%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ c (pow b 3.0))))
(if (<= b 1.15)
(/ 1.0 (/ 1.0 (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* a 2.0))))
(/
-1.0
(+ (/ b c) (* a (+ (* -2.0 (* a (- t_0 (* t_0 0.5)))) (/ -1.0 b))))))))
double code(double a, double b, double c) {
double t_0 = c / pow(b, 3.0);
double tmp;
if (b <= 1.15) {
tmp = 1.0 / (1.0 / ((sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (a * 2.0)));
} else {
tmp = -1.0 / ((b / c) + (a * ((-2.0 * (a * (t_0 - (t_0 * 0.5)))) + (-1.0 / b))));
}
return tmp;
}
function code(a, b, c) t_0 = Float64(c / (b ^ 3.0)) tmp = 0.0 if (b <= 1.15) tmp = Float64(1.0 / Float64(1.0 / Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(a * 2.0)))); else tmp = Float64(-1.0 / Float64(Float64(b / c) + Float64(a * Float64(Float64(-2.0 * Float64(a * Float64(t_0 - Float64(t_0 * 0.5)))) + Float64(-1.0 / b))))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.15], N[(1.0 / N[(1.0 / N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(N[(b / c), $MachinePrecision] + N[(a * N[(N[(-2.0 * N[(a * N[(t$95$0 - N[(t$95$0 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c}{{b}^{3}}\\
\mathbf{if}\;b \leq 1.15:\\
\;\;\;\;\frac{1}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{b}{c} + a \cdot \left(-2 \cdot \left(a \cdot \left(t\_0 - t\_0 \cdot 0.5\right)\right) + \frac{-1}{b}\right)}\\
\end{array}
\end{array}
if b < 1.1499999999999999Initial program 85.7%
*-commutative85.7%
Simplified85.7%
add-cbrt-cube84.8%
pow1/381.6%
pow381.7%
pow281.7%
pow-pow81.7%
metadata-eval81.7%
Applied egg-rr81.7%
+-commutative81.7%
add-cube-cbrt81.1%
fma-define81.2%
Applied egg-rr83.1%
clear-num83.1%
inv-pow83.1%
fmm-undef83.3%
cbrt-prod83.8%
add-sqr-sqrt83.4%
add-cbrt-cube85.6%
Applied egg-rr85.6%
unpow-185.6%
Simplified85.6%
clear-num85.6%
inv-pow85.6%
Applied egg-rr85.6%
unpow-185.6%
associate-/r*85.6%
associate-/l/85.6%
unpow285.6%
fmm-undef85.7%
distribute-rgt-neg-in85.7%
distribute-rgt-neg-in85.7%
metadata-eval85.7%
Simplified85.7%
if 1.1499999999999999 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
add-cbrt-cube48.1%
pow1/345.8%
pow345.8%
pow245.8%
pow-pow45.9%
metadata-eval45.9%
Applied egg-rr45.9%
+-commutative45.9%
add-cube-cbrt46.0%
fma-define45.9%
Applied egg-rr46.9%
clear-num46.9%
inv-pow46.9%
fmm-undef46.6%
cbrt-prod47.8%
add-sqr-sqrt47.4%
add-cbrt-cube48.6%
Applied egg-rr48.6%
unpow-148.6%
Simplified48.6%
Taylor expanded in a around 0 92.9%
Final simplification91.8%
(FPCore (a b c) :precision binary64 (if (<= b 3.4) (/ 1.0 (/ 1.0 (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* a 2.0)))) (/ 1.0 (- (/ a b) (/ b c)))))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.4) {
tmp = 1.0 / (1.0 / ((sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (a * 2.0)));
} else {
tmp = 1.0 / ((a / b) - (b / c));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 3.4) tmp = Float64(1.0 / Float64(1.0 / Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(a * 2.0)))); else tmp = Float64(1.0 / Float64(Float64(a / b) - Float64(b / c))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 3.4], N[(1.0 / N[(1.0 / N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.4:\\
\;\;\;\;\frac{1}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\
\end{array}
\end{array}
if b < 3.39999999999999991Initial program 84.2%
*-commutative84.2%
Simplified84.2%
add-cbrt-cube83.4%
pow1/380.6%
pow380.7%
pow280.7%
pow-pow80.8%
metadata-eval80.8%
Applied egg-rr80.8%
+-commutative80.8%
add-cube-cbrt79.8%
fma-define79.9%
Applied egg-rr81.8%
clear-num81.8%
inv-pow81.8%
fmm-undef81.9%
cbrt-prod82.6%
add-sqr-sqrt82.2%
add-cbrt-cube84.2%
Applied egg-rr84.2%
unpow-184.2%
Simplified84.2%
clear-num84.2%
inv-pow84.2%
Applied egg-rr84.2%
unpow-184.2%
associate-/r*84.2%
associate-/l/84.2%
unpow284.2%
fmm-undef84.3%
distribute-rgt-neg-in84.3%
distribute-rgt-neg-in84.3%
metadata-eval84.3%
Simplified84.3%
if 3.39999999999999991 < b Initial program 47.6%
*-commutative47.6%
Simplified47.6%
add-cbrt-cube47.2%
pow1/344.8%
pow344.8%
pow244.8%
pow-pow44.9%
metadata-eval44.9%
Applied egg-rr44.9%
+-commutative44.9%
add-cube-cbrt45.1%
fma-define45.0%
Applied egg-rr46.0%
clear-num46.0%
inv-pow46.0%
fmm-undef45.7%
cbrt-prod46.8%
add-sqr-sqrt46.5%
add-cbrt-cube47.6%
Applied egg-rr47.6%
unpow-147.6%
Simplified47.6%
Taylor expanded in a around 0 88.6%
Final simplification87.8%
(FPCore (a b c) :precision binary64 (if (<= b 3.5) (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* a 2.0)) (/ 1.0 (- (/ a b) (/ b c)))))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.5) {
tmp = (sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (a * 2.0);
} else {
tmp = 1.0 / ((a / b) - (b / c));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 3.5) tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(a * 2.0)); else tmp = Float64(1.0 / Float64(Float64(a / b) - Float64(b / c))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 3.5], N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.5:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\
\end{array}
\end{array}
if b < 3.5Initial program 84.2%
*-commutative84.2%
Simplified84.3%
if 3.5 < b Initial program 47.6%
*-commutative47.6%
Simplified47.6%
add-cbrt-cube47.2%
pow1/344.8%
pow344.8%
pow244.8%
pow-pow44.9%
metadata-eval44.9%
Applied egg-rr44.9%
+-commutative44.9%
add-cube-cbrt45.1%
fma-define45.0%
Applied egg-rr46.0%
clear-num46.0%
inv-pow46.0%
fmm-undef45.7%
cbrt-prod46.8%
add-sqr-sqrt46.5%
add-cbrt-cube47.6%
Applied egg-rr47.6%
unpow-147.6%
Simplified47.6%
Taylor expanded in a around 0 88.6%
Final simplification87.8%
(FPCore (a b c) :precision binary64 (if (<= b 3.4) (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) (/ 1.0 (- (/ a b) (/ b c)))))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.4) {
tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = 1.0 / ((a / b) - (b / c));
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 3.4d0) then
tmp = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
else
tmp = 1.0d0 / ((a / b) - (b / c))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 3.4) {
tmp = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = 1.0 / ((a / b) - (b / c));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3.4: tmp = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0) else: tmp = 1.0 / ((a / b) - (b / c)) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3.4) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)); else tmp = Float64(1.0 / Float64(Float64(a / b) - Float64(b / c))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 3.4) tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0); else tmp = 1.0 / ((a / b) - (b / c)); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3.4], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.4:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\
\end{array}
\end{array}
if b < 3.39999999999999991Initial program 84.2%
if 3.39999999999999991 < b Initial program 47.6%
*-commutative47.6%
Simplified47.6%
add-cbrt-cube47.2%
pow1/344.8%
pow344.8%
pow244.8%
pow-pow44.9%
metadata-eval44.9%
Applied egg-rr44.9%
+-commutative44.9%
add-cube-cbrt45.1%
fma-define45.0%
Applied egg-rr46.0%
clear-num46.0%
inv-pow46.0%
fmm-undef45.7%
cbrt-prod46.8%
add-sqr-sqrt46.5%
add-cbrt-cube47.6%
Applied egg-rr47.6%
unpow-147.6%
Simplified47.6%
Taylor expanded in a around 0 88.6%
Final simplification87.8%
(FPCore (a b c) :precision binary64 (/ 1.0 (- (/ a b) (/ b c))))
double code(double a, double b, double c) {
return 1.0 / ((a / b) - (b / c));
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = 1.0d0 / ((a / b) - (b / c))
end function
public static double code(double a, double b, double c) {
return 1.0 / ((a / b) - (b / c));
}
def code(a, b, c): return 1.0 / ((a / b) - (b / c))
function code(a, b, c) return Float64(1.0 / Float64(Float64(a / b) - Float64(b / c))) end
function tmp = code(a, b, c) tmp = 1.0 / ((a / b) - (b / c)); end
code[a_, b_, c_] := N[(1.0 / N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{a}{b} - \frac{b}{c}}
\end{array}
Initial program 54.4%
*-commutative54.4%
Simplified54.4%
add-cbrt-cube53.8%
pow1/351.4%
pow351.4%
pow251.4%
pow-pow51.5%
metadata-eval51.5%
Applied egg-rr51.5%
+-commutative51.5%
add-cube-cbrt51.5%
fma-define51.4%
Applied egg-rr52.6%
clear-num52.6%
inv-pow52.6%
fmm-undef52.4%
cbrt-prod53.4%
add-sqr-sqrt53.1%
add-cbrt-cube54.3%
Applied egg-rr54.3%
unpow-154.3%
Simplified54.3%
Taylor expanded in a around 0 82.6%
Final simplification82.6%
(FPCore (a b c) :precision binary64 (/ c (- b)))
double code(double a, double b, double c) {
return c / -b;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c / -b
end function
public static double code(double a, double b, double c) {
return c / -b;
}
def code(a, b, c): return c / -b
function code(a, b, c) return Float64(c / Float64(-b)) end
function tmp = code(a, b, c) tmp = c / -b; end
code[a_, b_, c_] := N[(c / (-b)), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{-b}
\end{array}
Initial program 54.4%
*-commutative54.4%
Simplified54.4%
Taylor expanded in b around inf 65.4%
associate-*r/65.4%
mul-1-neg65.4%
Simplified65.4%
Final simplification65.4%
herbie shell --seed 2024154
(FPCore (a b c)
:name "Quadratic roots, narrow range"
:precision binary64
:pre (and (and (and (< 1.0536712127723509e-8 a) (< a 94906265.62425156)) (and (< 1.0536712127723509e-8 b) (< b 94906265.62425156))) (and (< 1.0536712127723509e-8 c) (< c 94906265.62425156)))
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))