
(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 11 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 (- (pow b 2.0) (* c (* a 4.0)))))
(if (<= b 80.0)
(/ (/ (- t_0 (pow (- b) 2.0)) (+ b (sqrt t_0))) (* 2.0 a))
(/
1.0
(-
(*
a
(+
(*
a
(+
(*
-2.0
(/
(*
a
(- (+ (pow c 2.0) (* -2.5 (pow c 2.0))) (* (pow c 2.0) -0.5)))
(pow b 5.0)))
(/ c (pow b 3.0))))
(/ 1.0 b)))
(/ b c))))))
double code(double a, double b, double c) {
double t_0 = pow(b, 2.0) - (c * (a * 4.0));
double tmp;
if (b <= 80.0) {
tmp = ((t_0 - pow(-b, 2.0)) / (b + sqrt(t_0))) / (2.0 * a);
} else {
tmp = 1.0 / ((a * ((a * ((-2.0 * ((a * ((pow(c, 2.0) + (-2.5 * pow(c, 2.0))) - (pow(c, 2.0) * -0.5))) / pow(b, 5.0))) + (c / pow(b, 3.0)))) + (1.0 / 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) :: t_0
real(8) :: tmp
t_0 = (b ** 2.0d0) - (c * (a * 4.0d0))
if (b <= 80.0d0) then
tmp = ((t_0 - (-b ** 2.0d0)) / (b + sqrt(t_0))) / (2.0d0 * a)
else
tmp = 1.0d0 / ((a * ((a * (((-2.0d0) * ((a * (((c ** 2.0d0) + ((-2.5d0) * (c ** 2.0d0))) - ((c ** 2.0d0) * (-0.5d0)))) / (b ** 5.0d0))) + (c / (b ** 3.0d0)))) + (1.0d0 / b))) - (b / c))
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 <= 80.0) {
tmp = ((t_0 - Math.pow(-b, 2.0)) / (b + Math.sqrt(t_0))) / (2.0 * a);
} else {
tmp = 1.0 / ((a * ((a * ((-2.0 * ((a * ((Math.pow(c, 2.0) + (-2.5 * Math.pow(c, 2.0))) - (Math.pow(c, 2.0) * -0.5))) / Math.pow(b, 5.0))) + (c / Math.pow(b, 3.0)))) + (1.0 / b))) - (b / c));
}
return tmp;
}
def code(a, b, c): t_0 = math.pow(b, 2.0) - (c * (a * 4.0)) tmp = 0 if b <= 80.0: tmp = ((t_0 - math.pow(-b, 2.0)) / (b + math.sqrt(t_0))) / (2.0 * a) else: tmp = 1.0 / ((a * ((a * ((-2.0 * ((a * ((math.pow(c, 2.0) + (-2.5 * math.pow(c, 2.0))) - (math.pow(c, 2.0) * -0.5))) / math.pow(b, 5.0))) + (c / math.pow(b, 3.0)))) + (1.0 / b))) - (b / c)) return tmp
function code(a, b, c) t_0 = Float64((b ^ 2.0) - Float64(c * Float64(a * 4.0))) tmp = 0.0 if (b <= 80.0) tmp = Float64(Float64(Float64(t_0 - (Float64(-b) ^ 2.0)) / Float64(b + sqrt(t_0))) / Float64(2.0 * a)); else tmp = Float64(1.0 / Float64(Float64(a * Float64(Float64(a * Float64(Float64(-2.0 * Float64(Float64(a * Float64(Float64((c ^ 2.0) + Float64(-2.5 * (c ^ 2.0))) - Float64((c ^ 2.0) * -0.5))) / (b ^ 5.0))) + Float64(c / (b ^ 3.0)))) + Float64(1.0 / b))) - Float64(b / c))); 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 <= 80.0) tmp = ((t_0 - (-b ^ 2.0)) / (b + sqrt(t_0))) / (2.0 * a); else tmp = 1.0 / ((a * ((a * ((-2.0 * ((a * (((c ^ 2.0) + (-2.5 * (c ^ 2.0))) - ((c ^ 2.0) * -0.5))) / (b ^ 5.0))) + (c / (b ^ 3.0)))) + (1.0 / b))) - (b / c)); 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, 80.0], N[(N[(N[(t$95$0 - N[Power[(-b), 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a * N[(N[(a * N[(N[(-2.0 * N[(N[(a * N[(N[(N[Power[c, 2.0], $MachinePrecision] + N[(-2.5 * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[c, 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {b}^{2} - c \cdot \left(a \cdot 4\right)\\
\mathbf{if}\;b \leq 80:\\
\;\;\;\;\frac{\frac{t\_0 - {\left(-b\right)}^{2}}{b + \sqrt{t\_0}}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(a \cdot \left(-2 \cdot \frac{a \cdot \left(\left({c}^{2} + -2.5 \cdot {c}^{2}\right) - {c}^{2} \cdot -0.5\right)}{{b}^{5}} + \frac{c}{{b}^{3}}\right) + \frac{1}{b}\right) - \frac{b}{c}}\\
\end{array}
\end{array}
if b < 80Initial program 81.5%
*-commutative81.5%
Simplified81.5%
add-cbrt-cube80.5%
pow1/379.3%
pow379.4%
pow279.4%
pow-pow79.1%
metadata-eval79.1%
Applied egg-rr79.1%
unpow1/380.7%
Simplified80.7%
flip-+80.5%
pow280.5%
add-sqr-sqrt80.8%
pow1/379.3%
pow-pow82.8%
metadata-eval82.8%
*-commutative82.8%
*-commutative82.8%
pow1/382.7%
pow-pow82.9%
metadata-eval82.9%
*-commutative82.9%
*-commutative82.9%
Applied egg-rr82.9%
if 80 < b Initial program 48.6%
*-commutative48.6%
Simplified48.6%
add-cbrt-cube48.1%
pow1/345.7%
pow345.7%
pow245.7%
pow-pow45.7%
metadata-eval45.7%
Applied egg-rr45.7%
unpow1/348.4%
Simplified48.4%
clear-num48.4%
inv-pow48.4%
neg-mul-148.4%
fma-define48.4%
pow1/345.7%
pow-pow48.6%
metadata-eval48.6%
*-commutative48.6%
*-commutative48.6%
Applied egg-rr48.6%
unpow-148.6%
associate-/l*48.6%
*-commutative48.6%
*-commutative48.6%
associate-*r*48.6%
cancel-sign-sub-inv48.6%
metadata-eval48.6%
+-commutative48.6%
fma-define48.6%
*-commutative48.6%
Simplified48.6%
Taylor expanded in b around inf 94.7%
Simplified94.7%
Taylor expanded in a around 0 94.9%
Final simplification91.4%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (- (pow b 2.0) (* c (* a 4.0)))))
(if (<= b 80.0)
(/ (/ (- t_0 (pow (- b) 2.0)) (+ b (sqrt t_0))) (* 2.0 a))
(/
(-
(*
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 (- 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 <= 80.0) {
tmp = ((t_0 - pow(-b, 2.0)) / (b + sqrt(t_0))) / (2.0 * a);
} 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 / -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 <= 80.0d0) then
tmp = ((t_0 - (-b ** 2.0d0)) / (b + sqrt(t_0))) / (2.0d0 * a)
else
tmp = ((a * ((a * (((-5.0d0) * ((a * (c ** 4.0d0)) / (b ** 6.0d0))) + ((-2.0d0) * ((c ** 3.0d0) / (b ** 4.0d0))))) - ((c / -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 <= 80.0) {
tmp = ((t_0 - Math.pow(-b, 2.0)) / (b + Math.sqrt(t_0))) / (2.0 * a);
} 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 / -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 <= 80.0: tmp = ((t_0 - math.pow(-b, 2.0)) / (b + math.sqrt(t_0))) / (2.0 * a) 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 / -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 <= 80.0) tmp = Float64(Float64(Float64(t_0 - (Float64(-b) ^ 2.0)) / Float64(b + sqrt(t_0))) / Float64(2.0 * a)); 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 / Float64(-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 <= 80.0) tmp = ((t_0 - (-b ^ 2.0)) / (b + sqrt(t_0))) / (2.0 * a); else tmp = ((a * ((a * ((-5.0 * ((a * (c ^ 4.0)) / (b ^ 6.0))) + (-2.0 * ((c ^ 3.0) / (b ^ 4.0))))) - ((c / -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, 80.0], N[(N[(N[(t$95$0 - N[Power[(-b), 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $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[Power[N[(c / (-b)), $MachinePrecision], 2.0], $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 80:\\
\;\;\;\;\frac{\frac{t\_0 - {\left(-b\right)}^{2}}{b + \sqrt{t\_0}}}{2 \cdot a}\\
\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) - {\left(\frac{c}{-b}\right)}^{2}\right) - c}{b}\\
\end{array}
\end{array}
if b < 80Initial program 81.5%
*-commutative81.5%
Simplified81.5%
add-cbrt-cube80.5%
pow1/379.3%
pow379.4%
pow279.4%
pow-pow79.1%
metadata-eval79.1%
Applied egg-rr79.1%
unpow1/380.7%
Simplified80.7%
flip-+80.5%
pow280.5%
add-sqr-sqrt80.8%
pow1/379.3%
pow-pow82.8%
metadata-eval82.8%
*-commutative82.8%
*-commutative82.8%
pow1/382.7%
pow-pow82.9%
metadata-eval82.9%
*-commutative82.9%
*-commutative82.9%
Applied egg-rr82.9%
if 80 < b Initial program 48.6%
Simplified48.6%
Taylor expanded in b around inf 94.8%
Simplified94.8%
Taylor expanded in a around 0 94.8%
*-un-lft-identity94.8%
Applied egg-rr94.8%
*-lft-identity94.8%
unpow294.8%
unpow294.8%
times-frac94.8%
sqr-neg94.8%
distribute-frac-neg94.8%
distribute-frac-neg94.8%
unpow194.8%
pow-plus94.8%
distribute-frac-neg94.8%
distribute-neg-frac294.8%
metadata-eval94.8%
Simplified94.8%
Final simplification91.3%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (- (pow b 2.0) (* c (* a 4.0)))))
(if (<= b 80.0)
(/ (/ (- t_0 (pow (- b) 2.0)) (+ b (sqrt t_0))) (* 2.0 a))
(*
c
(+
(*
c
(-
(*
c
(*
(pow a 3.0)
(- (/ (* c -5.0) (pow b 7.0)) (/ 2.0 (* a (pow b 5.0))))))
(/ a (pow b 3.0))))
(/ -1.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 <= 80.0) {
tmp = ((t_0 - pow(-b, 2.0)) / (b + sqrt(t_0))) / (2.0 * a);
} else {
tmp = c * ((c * ((c * (pow(a, 3.0) * (((c * -5.0) / pow(b, 7.0)) - (2.0 / (a * pow(b, 5.0)))))) - (a / pow(b, 3.0)))) + (-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) :: tmp
t_0 = (b ** 2.0d0) - (c * (a * 4.0d0))
if (b <= 80.0d0) then
tmp = ((t_0 - (-b ** 2.0d0)) / (b + sqrt(t_0))) / (2.0d0 * a)
else
tmp = c * ((c * ((c * ((a ** 3.0d0) * (((c * (-5.0d0)) / (b ** 7.0d0)) - (2.0d0 / (a * (b ** 5.0d0)))))) - (a / (b ** 3.0d0)))) + ((-1.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 <= 80.0) {
tmp = ((t_0 - Math.pow(-b, 2.0)) / (b + Math.sqrt(t_0))) / (2.0 * a);
} else {
tmp = c * ((c * ((c * (Math.pow(a, 3.0) * (((c * -5.0) / Math.pow(b, 7.0)) - (2.0 / (a * Math.pow(b, 5.0)))))) - (a / Math.pow(b, 3.0)))) + (-1.0 / b));
}
return tmp;
}
def code(a, b, c): t_0 = math.pow(b, 2.0) - (c * (a * 4.0)) tmp = 0 if b <= 80.0: tmp = ((t_0 - math.pow(-b, 2.0)) / (b + math.sqrt(t_0))) / (2.0 * a) else: tmp = c * ((c * ((c * (math.pow(a, 3.0) * (((c * -5.0) / math.pow(b, 7.0)) - (2.0 / (a * math.pow(b, 5.0)))))) - (a / math.pow(b, 3.0)))) + (-1.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 <= 80.0) tmp = Float64(Float64(Float64(t_0 - (Float64(-b) ^ 2.0)) / Float64(b + sqrt(t_0))) / Float64(2.0 * a)); else tmp = Float64(c * Float64(Float64(c * Float64(Float64(c * Float64((a ^ 3.0) * Float64(Float64(Float64(c * -5.0) / (b ^ 7.0)) - Float64(2.0 / Float64(a * (b ^ 5.0)))))) - Float64(a / (b ^ 3.0)))) + Float64(-1.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 <= 80.0) tmp = ((t_0 - (-b ^ 2.0)) / (b + sqrt(t_0))) / (2.0 * a); else tmp = c * ((c * ((c * ((a ^ 3.0) * (((c * -5.0) / (b ^ 7.0)) - (2.0 / (a * (b ^ 5.0)))))) - (a / (b ^ 3.0)))) + (-1.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, 80.0], N[(N[(N[(t$95$0 - N[Power[(-b), 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(c * N[(N[(c * N[(N[Power[a, 3.0], $MachinePrecision] * N[(N[(N[(c * -5.0), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision] - N[(2.0 / N[(a * N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {b}^{2} - c \cdot \left(a \cdot 4\right)\\
\mathbf{if}\;b \leq 80:\\
\;\;\;\;\frac{\frac{t\_0 - {\left(-b\right)}^{2}}{b + \sqrt{t\_0}}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(c \cdot \left(c \cdot \left({a}^{3} \cdot \left(\frac{c \cdot -5}{{b}^{7}} - \frac{2}{a \cdot {b}^{5}}\right)\right) - \frac{a}{{b}^{3}}\right) + \frac{-1}{b}\right)\\
\end{array}
\end{array}
if b < 80Initial program 81.5%
*-commutative81.5%
Simplified81.5%
add-cbrt-cube80.5%
pow1/379.3%
pow379.4%
pow279.4%
pow-pow79.1%
metadata-eval79.1%
Applied egg-rr79.1%
unpow1/380.7%
Simplified80.7%
flip-+80.5%
pow280.5%
add-sqr-sqrt80.8%
pow1/379.3%
pow-pow82.8%
metadata-eval82.8%
*-commutative82.8%
*-commutative82.8%
pow1/382.7%
pow-pow82.9%
metadata-eval82.9%
*-commutative82.9%
*-commutative82.9%
Applied egg-rr82.9%
if 80 < b Initial program 48.6%
Simplified48.6%
Taylor expanded in b around inf 94.8%
Simplified94.8%
Taylor expanded in c around 0 94.5%
Taylor expanded in a around inf 94.5%
associate-*r/94.5%
associate-*r/94.5%
metadata-eval94.5%
Simplified94.5%
Final simplification91.1%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (- (pow b 2.0) (* c (* a 4.0)))))
(if (<= b 160.0)
(/ (/ (- t_0 (pow (- b) 2.0)) (+ b (sqrt t_0))) (* 2.0 a))
(/ 1.0 (- (* a (+ (/ 1.0 b) (/ (* c a) (pow b 3.0)))) (/ b c))))))
double code(double a, double b, double c) {
double t_0 = pow(b, 2.0) - (c * (a * 4.0));
double tmp;
if (b <= 160.0) {
tmp = ((t_0 - pow(-b, 2.0)) / (b + sqrt(t_0))) / (2.0 * a);
} else {
tmp = 1.0 / ((a * ((1.0 / b) + ((c * a) / pow(b, 3.0)))) - (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) :: t_0
real(8) :: tmp
t_0 = (b ** 2.0d0) - (c * (a * 4.0d0))
if (b <= 160.0d0) then
tmp = ((t_0 - (-b ** 2.0d0)) / (b + sqrt(t_0))) / (2.0d0 * a)
else
tmp = 1.0d0 / ((a * ((1.0d0 / b) + ((c * a) / (b ** 3.0d0)))) - (b / c))
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 <= 160.0) {
tmp = ((t_0 - Math.pow(-b, 2.0)) / (b + Math.sqrt(t_0))) / (2.0 * a);
} else {
tmp = 1.0 / ((a * ((1.0 / b) + ((c * a) / Math.pow(b, 3.0)))) - (b / c));
}
return tmp;
}
def code(a, b, c): t_0 = math.pow(b, 2.0) - (c * (a * 4.0)) tmp = 0 if b <= 160.0: tmp = ((t_0 - math.pow(-b, 2.0)) / (b + math.sqrt(t_0))) / (2.0 * a) else: tmp = 1.0 / ((a * ((1.0 / b) + ((c * a) / math.pow(b, 3.0)))) - (b / c)) return tmp
function code(a, b, c) t_0 = Float64((b ^ 2.0) - Float64(c * Float64(a * 4.0))) tmp = 0.0 if (b <= 160.0) tmp = Float64(Float64(Float64(t_0 - (Float64(-b) ^ 2.0)) / Float64(b + sqrt(t_0))) / Float64(2.0 * a)); else tmp = Float64(1.0 / Float64(Float64(a * Float64(Float64(1.0 / b) + Float64(Float64(c * a) / (b ^ 3.0)))) - Float64(b / c))); 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 <= 160.0) tmp = ((t_0 - (-b ^ 2.0)) / (b + sqrt(t_0))) / (2.0 * a); else tmp = 1.0 / ((a * ((1.0 / b) + ((c * a) / (b ^ 3.0)))) - (b / c)); 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, 160.0], N[(N[(N[(t$95$0 - N[Power[(-b), 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a * N[(N[(1.0 / b), $MachinePrecision] + N[(N[(c * a), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {b}^{2} - c \cdot \left(a \cdot 4\right)\\
\mathbf{if}\;b \leq 160:\\
\;\;\;\;\frac{\frac{t\_0 - {\left(-b\right)}^{2}}{b + \sqrt{t\_0}}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(\frac{1}{b} + \frac{c \cdot a}{{b}^{3}}\right) - \frac{b}{c}}\\
\end{array}
\end{array}
if b < 160Initial program 80.7%
*-commutative80.7%
Simplified80.7%
add-cbrt-cube79.7%
pow1/378.2%
pow378.2%
pow278.2%
pow-pow77.9%
metadata-eval77.9%
Applied egg-rr77.9%
unpow1/380.0%
Simplified80.0%
flip-+79.8%
pow279.8%
add-sqr-sqrt80.1%
pow1/378.1%
pow-pow82.1%
metadata-eval82.1%
*-commutative82.1%
*-commutative82.1%
pow1/382.0%
pow-pow82.1%
metadata-eval82.1%
*-commutative82.1%
*-commutative82.1%
Applied egg-rr82.1%
if 160 < b Initial program 46.7%
*-commutative46.7%
Simplified46.7%
add-cbrt-cube46.2%
pow1/343.9%
pow343.9%
pow243.9%
pow-pow43.9%
metadata-eval43.9%
Applied egg-rr43.9%
unpow1/346.5%
Simplified46.5%
clear-num46.5%
inv-pow46.5%
neg-mul-146.5%
fma-define46.5%
pow1/343.9%
pow-pow46.7%
metadata-eval46.7%
*-commutative46.7%
*-commutative46.7%
Applied egg-rr46.7%
unpow-146.7%
associate-/l*46.7%
*-commutative46.7%
*-commutative46.7%
associate-*r*46.7%
cancel-sign-sub-inv46.7%
metadata-eval46.7%
+-commutative46.7%
fma-define46.7%
*-commutative46.7%
Simplified46.7%
Taylor expanded in b around inf 95.8%
Simplified95.8%
Taylor expanded in a around 0 94.2%
Final simplification90.2%
(FPCore (a b c) :precision binary64 (if (<= b 160.0) (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* 2.0 a)) (/ 1.0 (- (* a (+ (/ 1.0 b) (/ (* c a) (pow b 3.0)))) (/ b c)))))
double code(double a, double b, double c) {
double tmp;
if (b <= 160.0) {
tmp = (sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (2.0 * a);
} else {
tmp = 1.0 / ((a * ((1.0 / b) + ((c * a) / pow(b, 3.0)))) - (b / c));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 160.0) tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(2.0 * a)); else tmp = Float64(1.0 / Float64(Float64(a * Float64(Float64(1.0 / b) + Float64(Float64(c * a) / (b ^ 3.0)))) - Float64(b / c))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 160.0], N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a * N[(N[(1.0 / b), $MachinePrecision] + N[(N[(c * a), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 160:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(\frac{1}{b} + \frac{c \cdot a}{{b}^{3}}\right) - \frac{b}{c}}\\
\end{array}
\end{array}
if b < 160Initial program 80.7%
*-commutative80.7%
Simplified80.8%
if 160 < b Initial program 46.7%
*-commutative46.7%
Simplified46.7%
add-cbrt-cube46.2%
pow1/343.9%
pow343.9%
pow243.9%
pow-pow43.9%
metadata-eval43.9%
Applied egg-rr43.9%
unpow1/346.5%
Simplified46.5%
clear-num46.5%
inv-pow46.5%
neg-mul-146.5%
fma-define46.5%
pow1/343.9%
pow-pow46.7%
metadata-eval46.7%
*-commutative46.7%
*-commutative46.7%
Applied egg-rr46.7%
unpow-146.7%
associate-/l*46.7%
*-commutative46.7%
*-commutative46.7%
associate-*r*46.7%
cancel-sign-sub-inv46.7%
metadata-eval46.7%
+-commutative46.7%
fma-define46.7%
*-commutative46.7%
Simplified46.7%
Taylor expanded in b around inf 95.8%
Simplified95.8%
Taylor expanded in a around 0 94.2%
Final simplification89.7%
(FPCore (a b c) :precision binary64 (if (<= b 160.0) (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* 2.0 a)) (/ 1.0 (- (* a (+ (/ 1.0 b) (/ (* c a) (pow b 3.0)))) (/ b c)))))
double code(double a, double b, double c) {
double tmp;
if (b <= 160.0) {
tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a);
} else {
tmp = 1.0 / ((a * ((1.0 / b) + ((c * a) / pow(b, 3.0)))) - (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 <= 160.0d0) then
tmp = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (2.0d0 * a)
else
tmp = 1.0d0 / ((a * ((1.0d0 / b) + ((c * a) / (b ** 3.0d0)))) - (b / c))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 160.0) {
tmp = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a);
} else {
tmp = 1.0 / ((a * ((1.0 / b) + ((c * a) / Math.pow(b, 3.0)))) - (b / c));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 160.0: tmp = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a) else: tmp = 1.0 / ((a * ((1.0 / b) + ((c * a) / math.pow(b, 3.0)))) - (b / c)) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 160.0) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(2.0 * a)); else tmp = Float64(1.0 / Float64(Float64(a * Float64(Float64(1.0 / b) + Float64(Float64(c * a) / (b ^ 3.0)))) - Float64(b / c))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 160.0) tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a); else tmp = 1.0 / ((a * ((1.0 / b) + ((c * a) / (b ^ 3.0)))) - (b / c)); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 160.0], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a * N[(N[(1.0 / b), $MachinePrecision] + N[(N[(c * a), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 160:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(\frac{1}{b} + \frac{c \cdot a}{{b}^{3}}\right) - \frac{b}{c}}\\
\end{array}
\end{array}
if b < 160Initial program 80.7%
if 160 < b Initial program 46.7%
*-commutative46.7%
Simplified46.7%
add-cbrt-cube46.2%
pow1/343.9%
pow343.9%
pow243.9%
pow-pow43.9%
metadata-eval43.9%
Applied egg-rr43.9%
unpow1/346.5%
Simplified46.5%
clear-num46.5%
inv-pow46.5%
neg-mul-146.5%
fma-define46.5%
pow1/343.9%
pow-pow46.7%
metadata-eval46.7%
*-commutative46.7%
*-commutative46.7%
Applied egg-rr46.7%
unpow-146.7%
associate-/l*46.7%
*-commutative46.7%
*-commutative46.7%
associate-*r*46.7%
cancel-sign-sub-inv46.7%
metadata-eval46.7%
+-commutative46.7%
fma-define46.7%
*-commutative46.7%
Simplified46.7%
Taylor expanded in b around inf 95.8%
Simplified95.8%
Taylor expanded in a around 0 94.2%
Final simplification89.7%
(FPCore (a b c) :precision binary64 (if (<= b 160.0) (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* 2.0 a)) (/ 1.0 (/ (- (/ (* c a) b) b) c))))
double code(double a, double b, double c) {
double tmp;
if (b <= 160.0) {
tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a);
} else {
tmp = 1.0 / ((((c * 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 <= 160.0d0) then
tmp = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (2.0d0 * a)
else
tmp = 1.0d0 / ((((c * a) / b) - b) / c)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 160.0) {
tmp = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a);
} else {
tmp = 1.0 / ((((c * a) / b) - b) / c);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 160.0: tmp = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a) else: tmp = 1.0 / ((((c * a) / b) - b) / c) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 160.0) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(2.0 * a)); else tmp = Float64(1.0 / Float64(Float64(Float64(Float64(c * a) / b) - b) / c)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 160.0) tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a); else tmp = 1.0 / ((((c * a) / b) - b) / c); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 160.0], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision] - b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 160:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\frac{c \cdot a}{b} - b}{c}}\\
\end{array}
\end{array}
if b < 160Initial program 80.7%
if 160 < b Initial program 46.7%
*-commutative46.7%
Simplified46.7%
add-cbrt-cube46.2%
pow1/343.9%
pow343.9%
pow243.9%
pow-pow43.9%
metadata-eval43.9%
Applied egg-rr43.9%
unpow1/346.5%
Simplified46.5%
clear-num46.5%
inv-pow46.5%
neg-mul-146.5%
fma-define46.5%
pow1/343.9%
pow-pow46.7%
metadata-eval46.7%
*-commutative46.7%
*-commutative46.7%
Applied egg-rr46.7%
unpow-146.7%
associate-/l*46.7%
*-commutative46.7%
*-commutative46.7%
associate-*r*46.7%
cancel-sign-sub-inv46.7%
metadata-eval46.7%
+-commutative46.7%
fma-define46.7%
*-commutative46.7%
Simplified46.7%
Taylor expanded in b around inf 95.8%
Simplified95.8%
Taylor expanded in c around 0 88.7%
Final simplification86.0%
(FPCore (a b c) :precision binary64 (/ 1.0 (/ (- (/ (* c a) b) b) c)))
double code(double a, double b, double c) {
return 1.0 / ((((c * 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 / ((((c * a) / b) - b) / c)
end function
public static double code(double a, double b, double c) {
return 1.0 / ((((c * a) / b) - b) / c);
}
def code(a, b, c): return 1.0 / ((((c * a) / b) - b) / c)
function code(a, b, c) return Float64(1.0 / Float64(Float64(Float64(Float64(c * a) / b) - b) / c)) end
function tmp = code(a, b, c) tmp = 1.0 / ((((c * a) / b) - b) / c); end
code[a_, b_, c_] := N[(1.0 / N[(N[(N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision] - b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{\frac{c \cdot a}{b} - b}{c}}
\end{array}
Initial program 58.1%
*-commutative58.1%
Simplified58.1%
add-cbrt-cube57.5%
pow1/355.4%
pow355.4%
pow255.4%
pow-pow55.4%
metadata-eval55.4%
Applied egg-rr55.4%
unpow1/357.8%
Simplified57.8%
clear-num57.8%
inv-pow57.8%
neg-mul-157.8%
fma-define57.8%
pow1/355.3%
pow-pow58.1%
metadata-eval58.1%
*-commutative58.1%
*-commutative58.1%
Applied egg-rr58.1%
unpow-158.1%
associate-/l*58.1%
*-commutative58.1%
*-commutative58.1%
associate-*r*58.1%
cancel-sign-sub-inv58.1%
metadata-eval58.1%
+-commutative58.1%
fma-define58.1%
*-commutative58.1%
Simplified58.1%
Taylor expanded in b around inf 89.3%
Simplified89.3%
Taylor expanded in c around 0 79.3%
Final simplification79.3%
(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 58.1%
*-commutative58.1%
Simplified58.1%
add-cbrt-cube57.5%
pow1/355.4%
pow355.4%
pow255.4%
pow-pow55.4%
metadata-eval55.4%
Applied egg-rr55.4%
unpow1/357.8%
Simplified57.8%
clear-num57.8%
inv-pow57.8%
neg-mul-157.8%
fma-define57.8%
pow1/355.3%
pow-pow58.1%
metadata-eval58.1%
*-commutative58.1%
*-commutative58.1%
Applied egg-rr58.1%
unpow-158.1%
associate-/l*58.1%
*-commutative58.1%
*-commutative58.1%
associate-*r*58.1%
cancel-sign-sub-inv58.1%
metadata-eval58.1%
+-commutative58.1%
fma-define58.1%
*-commutative58.1%
Simplified58.1%
Taylor expanded in b around inf 89.3%
Simplified89.3%
Taylor expanded in a around 0 79.3%
Final simplification79.3%
(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 58.1%
Simplified58.1%
Taylor expanded in a around 0 61.9%
associate-*r/61.9%
mul-1-neg61.9%
Simplified61.9%
Final simplification61.9%
(FPCore (a b c) :precision binary64 (/ b a))
double code(double a, double b, double c) {
return b / 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 / a
end function
public static double code(double a, double b, double c) {
return b / a;
}
def code(a, b, c): return b / a
function code(a, b, c) return Float64(b / a) end
function tmp = code(a, b, c) tmp = b / a; end
code[a_, b_, c_] := N[(b / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{a}
\end{array}
Initial program 58.1%
*-commutative58.1%
Simplified58.1%
add-cbrt-cube57.5%
pow1/355.4%
pow355.4%
pow255.4%
pow-pow55.4%
metadata-eval55.4%
Applied egg-rr55.4%
unpow1/357.8%
Simplified57.8%
clear-num57.8%
inv-pow57.8%
neg-mul-157.8%
fma-define57.8%
pow1/355.3%
pow-pow58.1%
metadata-eval58.1%
*-commutative58.1%
*-commutative58.1%
Applied egg-rr58.1%
unpow-158.1%
associate-/l*58.1%
*-commutative58.1%
*-commutative58.1%
associate-*r*58.1%
cancel-sign-sub-inv58.1%
metadata-eval58.1%
+-commutative58.1%
fma-define58.1%
*-commutative58.1%
Simplified58.1%
Taylor expanded in b around inf 79.1%
*-commutative79.1%
Simplified79.1%
Taylor expanded in a around inf 1.6%
herbie shell --seed 2024152
(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)))