
(FPCore (a b c) :precision binary64 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c))))) (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (+ (- b) t_0) (* 2.0 a)))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
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 = sqrt(((b * b) - ((4.0d0 * a) * c)))
if (b >= 0.0d0) then
tmp = (2.0d0 * c) / (-b - t_0)
else
tmp = (-b + t_0) / (2.0d0 * a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - ((4.0 * a) * c))) tmp = 0 if b >= 0.0: tmp = (2.0 * c) / (-b - t_0) else: tmp = (-b + t_0) / (2.0 * a) return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0)); else tmp = Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a)); end return tmp end
function tmp_2 = code(a, b, c) t_0 = sqrt(((b * b) - ((4.0 * a) * c))); tmp = 0.0; if (b >= 0.0) tmp = (2.0 * c) / (-b - t_0); else tmp = (-b + t_0) / (2.0 * a); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c))))) (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (+ (- b) t_0) (* 2.0 a)))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
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 = sqrt(((b * b) - ((4.0d0 * a) * c)))
if (b >= 0.0d0) then
tmp = (2.0d0 * c) / (-b - t_0)
else
tmp = (-b + t_0) / (2.0d0 * a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - ((4.0 * a) * c))) tmp = 0 if b >= 0.0: tmp = (2.0 * c) / (-b - t_0) else: tmp = (-b + t_0) / (2.0 * a) return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0)); else tmp = Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a)); end return tmp end
function tmp_2 = code(a, b, c) t_0 = sqrt(((b * b) - ((4.0 * a) * c))); tmp = 0.0; if (b >= 0.0) tmp = (2.0 * c) / (-b - t_0); else tmp = (-b + t_0) / (2.0 * a); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ b (- a))) (t_1 (sqrt (- (* b b) (* c (* a 4.0))))))
(if (<= b -5e+153)
(if (>= b 0.0) (/ b a) t_0)
(if (<= b 2.9e-196)
(if (>= b 0.0)
(/ (* 2.0 c) (* 2.0 (fma a (/ c b) (- b))))
(/ (- t_1 b) (* a 2.0)))
(if (<= b 4.8e+142)
(if (>= b 0.0)
(/ (* 2.0 c) (- (- b) t_1))
(* b (+ (/ c (pow b 2.0)) (/ -1.0 a))))
(if (>= b 0.0) (/ c (- b)) t_0))))))
double code(double a, double b, double c) {
double t_0 = b / -a;
double t_1 = sqrt(((b * b) - (c * (a * 4.0))));
double tmp_1;
if (b <= -5e+153) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = t_0;
}
tmp_1 = tmp_2;
} else if (b <= 2.9e-196) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (2.0 * c) / (2.0 * fma(a, (c / b), -b));
} else {
tmp_3 = (t_1 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b <= 4.8e+142) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = (2.0 * c) / (-b - t_1);
} else {
tmp_4 = b * ((c / pow(b, 2.0)) + (-1.0 / a));
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = c / -b;
} else {
tmp_1 = t_0;
}
return tmp_1;
}
function code(a, b, c) t_0 = Float64(b / Float64(-a)) t_1 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) tmp_1 = 0.0 if (b <= -5e+153) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(b / a); else tmp_2 = t_0; end tmp_1 = tmp_2; elseif (b <= 2.9e-196) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(2.0 * c) / Float64(2.0 * fma(a, Float64(c / b), Float64(-b)))); else tmp_3 = Float64(Float64(t_1 - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b <= 4.8e+142) tmp_4 = 0.0 if (b >= 0.0) tmp_4 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_1)); else tmp_4 = Float64(b * Float64(Float64(c / (b ^ 2.0)) + Float64(-1.0 / a))); end tmp_1 = tmp_4; elseif (b >= 0.0) tmp_1 = Float64(c / Float64(-b)); else tmp_1 = t_0; end return tmp_1 end
code[a_, b_, c_] := Block[{t$95$0 = N[(b / (-a)), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -5e+153], If[GreaterEqual[b, 0.0], N[(b / a), $MachinePrecision], t$95$0], If[LessEqual[b, 2.9e-196], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[(2.0 * N[(a * N[(c / b), $MachinePrecision] + (-b)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 4.8e+142], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$1), $MachinePrecision]), $MachinePrecision], N[(b * N[(N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(c / (-b)), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{-a}\\
t_1 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
\mathbf{if}\;b \leq -5 \cdot 10^{+153}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}\\
\mathbf{elif}\;b \leq 2.9 \cdot 10^{-196}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1 - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \leq 4.8 \cdot 10^{+142}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_1}\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c}{-b}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -5.00000000000000018e153Initial program 37.7%
Taylor expanded in b around -inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in a around 0 100.0%
distribute-lft-out--100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in b around 0 100.0%
*-commutative100.0%
associate-*r/100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in c around inf 100.0%
if -5.00000000000000018e153 < b < 2.89999999999999987e-196Initial program 81.5%
Taylor expanded in a around 0 82.7%
distribute-lft-out--82.7%
associate-/l*83.1%
fmm-def83.1%
Simplified83.1%
if 2.89999999999999987e-196 < b < 4.7999999999999998e142Initial program 91.7%
frac-2neg91.7%
div-inv91.7%
Applied egg-rr91.7%
Taylor expanded in b around -inf 91.7%
associate-*r*91.7%
neg-mul-191.7%
+-commutative91.7%
mul-1-neg91.7%
unsub-neg91.7%
Simplified91.7%
if 4.7999999999999998e142 < b Initial program 48.8%
Taylor expanded in b around -inf 48.8%
*-commutative48.8%
Simplified48.8%
Taylor expanded in a around 0 94.7%
distribute-lft-out--94.7%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in b around 0 94.7%
*-commutative94.7%
associate-*r/94.7%
neg-mul-194.7%
Simplified94.7%
Taylor expanded in c around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
Final simplification91.6%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (* b -2.0) (* a 2.0))) (t_1 (sqrt (* c (* a -4.0)))))
(if (<= b -3.1e-39)
(if (>= b 0.0) (/ b a) (/ b (- a)))
(if (<= b 6.5e-199)
(if (>= b 0.0)
(/ (* 2.0 c) (* 2.0 (fma a (/ c b) (- b))))
(/ (- t_1 b) (* a 2.0)))
(if (<= b 8e-72)
(if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_1)) t_0)
(if (>= b 0.0) (/ (* 2.0 c) (* 2.0 (- (* a (/ c b)) b))) t_0))))))
double code(double a, double b, double c) {
double t_0 = (b * -2.0) / (a * 2.0);
double t_1 = sqrt((c * (a * -4.0)));
double tmp_1;
if (b <= -3.1e-39) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 6.5e-199) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (2.0 * c) / (2.0 * fma(a, (c / b), -b));
} else {
tmp_3 = (t_1 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b <= 8e-72) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = (2.0 * c) / (-b - t_1);
} else {
tmp_4 = t_0;
}
tmp_1 = tmp_4;
} else if (b >= 0.0) {
tmp_1 = (2.0 * c) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = t_0;
}
return tmp_1;
}
function code(a, b, c) t_0 = Float64(Float64(b * -2.0) / Float64(a * 2.0)) t_1 = sqrt(Float64(c * Float64(a * -4.0))) tmp_1 = 0.0 if (b <= -3.1e-39) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(b / a); else tmp_2 = Float64(b / Float64(-a)); end tmp_1 = tmp_2; elseif (b <= 6.5e-199) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(2.0 * c) / Float64(2.0 * fma(a, Float64(c / b), Float64(-b)))); else tmp_3 = Float64(Float64(t_1 - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b <= 8e-72) tmp_4 = 0.0 if (b >= 0.0) tmp_4 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_1)); else tmp_4 = t_0; end tmp_1 = tmp_4; elseif (b >= 0.0) tmp_1 = Float64(Float64(2.0 * c) / Float64(2.0 * Float64(Float64(a * Float64(c / b)) - b))); else tmp_1 = t_0; end return tmp_1 end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(b * -2.0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -3.1e-39], If[GreaterEqual[b, 0.0], N[(b / a), $MachinePrecision], N[(b / (-a)), $MachinePrecision]], If[LessEqual[b, 6.5e-199], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[(2.0 * N[(a * N[(c / b), $MachinePrecision] + (-b)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 8e-72], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$1), $MachinePrecision]), $MachinePrecision], t$95$0], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[(2.0 * N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b \cdot -2}{a \cdot 2}\\
t_1 := \sqrt{c \cdot \left(a \cdot -4\right)}\\
\mathbf{if}\;b \leq -3.1 \cdot 10^{-39}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}\\
\mathbf{elif}\;b \leq 6.5 \cdot 10^{-199}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1 - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \leq 8 \cdot 10^{-72}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot \left(a \cdot \frac{c}{b} - b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < -3.0999999999999997e-39Initial program 66.4%
Taylor expanded in b around -inf 85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in a around 0 85.5%
distribute-lft-out--85.5%
associate-/l*85.5%
Simplified85.5%
Taylor expanded in b around 0 85.5%
*-commutative85.5%
associate-*r/85.5%
neg-mul-185.5%
Simplified85.5%
Taylor expanded in c around inf 85.5%
if -3.0999999999999997e-39 < b < 6.50000000000000017e-199Initial program 74.2%
Taylor expanded in a around 0 76.6%
distribute-lft-out--76.6%
associate-/l*77.3%
fmm-def77.3%
Simplified77.3%
Taylor expanded in b around 0 70.4%
*-commutative70.4%
*-commutative70.4%
associate-*r*70.4%
Simplified70.4%
if 6.50000000000000017e-199 < b < 7.9999999999999997e-72Initial program 84.8%
Taylor expanded in b around -inf 84.8%
*-commutative84.8%
Simplified84.8%
Taylor expanded in b around 0 70.8%
*-commutative18.0%
*-commutative18.0%
associate-*r*18.0%
Simplified70.8%
if 7.9999999999999997e-72 < b Initial program 69.7%
Taylor expanded in b around -inf 69.7%
*-commutative69.7%
Simplified69.7%
Taylor expanded in a around 0 86.2%
distribute-lft-out--86.2%
associate-/l*89.0%
Simplified89.0%
Final simplification82.6%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (- (* b b) (* c (* a 4.0))))) (t_1 (/ b (- a))))
(if (<= b -5.3e+153)
(if (>= b 0.0) (/ b a) t_1)
(if (<= b 4.5e+142)
(if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (- t_0 b) (* a 2.0)))
(if (>= b 0.0) (/ c (- b)) t_1)))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - (c * (a * 4.0))));
double t_1 = b / -a;
double tmp_1;
if (b <= -5.3e+153) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = t_1;
}
tmp_1 = tmp_2;
} else if (b <= 4.5e+142) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (2.0 * c) / (-b - t_0);
} else {
tmp_3 = (t_0 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = c / -b;
} else {
tmp_1 = t_1;
}
return tmp_1;
}
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
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
t_0 = sqrt(((b * b) - (c * (a * 4.0d0))))
t_1 = b / -a
if (b <= (-5.3d+153)) then
if (b >= 0.0d0) then
tmp_2 = b / a
else
tmp_2 = t_1
end if
tmp_1 = tmp_2
else if (b <= 4.5d+142) then
if (b >= 0.0d0) then
tmp_3 = (2.0d0 * c) / (-b - t_0)
else
tmp_3 = (t_0 - b) / (a * 2.0d0)
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = c / -b
else
tmp_1 = t_1
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - (c * (a * 4.0))));
double t_1 = b / -a;
double tmp_1;
if (b <= -5.3e+153) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = t_1;
}
tmp_1 = tmp_2;
} else if (b <= 4.5e+142) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (2.0 * c) / (-b - t_0);
} else {
tmp_3 = (t_0 - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = c / -b;
} else {
tmp_1 = t_1;
}
return tmp_1;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - (c * (a * 4.0)))) t_1 = b / -a tmp_1 = 0 if b <= -5.3e+153: tmp_2 = 0 if b >= 0.0: tmp_2 = b / a else: tmp_2 = t_1 tmp_1 = tmp_2 elif b <= 4.5e+142: tmp_3 = 0 if b >= 0.0: tmp_3 = (2.0 * c) / (-b - t_0) else: tmp_3 = (t_0 - b) / (a * 2.0) tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = c / -b else: tmp_1 = t_1 return tmp_1
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) t_1 = Float64(b / Float64(-a)) tmp_1 = 0.0 if (b <= -5.3e+153) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(b / a); else tmp_2 = t_1; end tmp_1 = tmp_2; elseif (b <= 4.5e+142) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0)); else tmp_3 = Float64(Float64(t_0 - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(c / Float64(-b)); else tmp_1 = t_1; end return tmp_1 end
function tmp_5 = code(a, b, c) t_0 = sqrt(((b * b) - (c * (a * 4.0)))); t_1 = b / -a; tmp_2 = 0.0; if (b <= -5.3e+153) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = b / a; else tmp_3 = t_1; end tmp_2 = tmp_3; elseif (b <= 4.5e+142) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = (2.0 * c) / (-b - t_0); else tmp_4 = (t_0 - b) / (a * 2.0); end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = c / -b; else tmp_2 = t_1; end tmp_5 = tmp_2; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(b / (-a)), $MachinePrecision]}, If[LessEqual[b, -5.3e+153], If[GreaterEqual[b, 0.0], N[(b / a), $MachinePrecision], t$95$1], If[LessEqual[b, 4.5e+142], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(c / (-b)), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
t_1 := \frac{b}{-a}\\
\mathbf{if}\;b \leq -5.3 \cdot 10^{+153}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}\\
\mathbf{elif}\;b \leq 4.5 \cdot 10^{+142}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c}{-b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -5.2999999999999999e153Initial program 37.7%
Taylor expanded in b around -inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in a around 0 100.0%
distribute-lft-out--100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in b around 0 100.0%
*-commutative100.0%
associate-*r/100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in c around inf 100.0%
if -5.2999999999999999e153 < b < 4.4999999999999999e142Initial program 86.0%
if 4.4999999999999999e142 < b Initial program 48.8%
Taylor expanded in b around -inf 48.8%
*-commutative48.8%
Simplified48.8%
Taylor expanded in a around 0 94.7%
distribute-lft-out--94.7%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in b around 0 94.7%
*-commutative94.7%
associate-*r/94.7%
neg-mul-194.7%
Simplified94.7%
Taylor expanded in c around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
Final simplification91.0%
(FPCore (a b c)
:precision binary64
(if (<= b -9e+153)
(if (>= b 0.0) (/ b a) (/ b (- a)))
(if (<= b 1.4e-71)
(if (>= b 0.0)
(* (* 2.0 c) (/ -1.0 (+ b (sqrt (* c (* a -4.0))))))
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)))
(if (>= b 0.0)
(/ (* 2.0 c) (* 2.0 (- (* a (/ c b)) b)))
(/ (* b -2.0) (* a 2.0))))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= -9e+153) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 1.4e-71) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (2.0 * c) * (-1.0 / (b + sqrt((c * (a * -4.0)))));
} else {
tmp_3 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (2.0 * c) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
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
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
if (b <= (-9d+153)) then
if (b >= 0.0d0) then
tmp_2 = b / a
else
tmp_2 = b / -a
end if
tmp_1 = tmp_2
else if (b <= 1.4d-71) then
if (b >= 0.0d0) then
tmp_3 = (2.0d0 * c) * ((-1.0d0) / (b + sqrt((c * (a * (-4.0d0))))))
else
tmp_3 = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
end if
tmp_1 = tmp_3
else if (b >= 0.0d0) then
tmp_1 = (2.0d0 * c) / (2.0d0 * ((a * (c / b)) - b))
else
tmp_1 = (b * (-2.0d0)) / (a * 2.0d0)
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= -9e+153) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b <= 1.4e-71) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (2.0 * c) * (-1.0 / (b + Math.sqrt((c * (a * -4.0)))));
} else {
tmp_3 = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = (2.0 * c) / (2.0 * ((a * (c / b)) - b));
} else {
tmp_1 = (b * -2.0) / (a * 2.0);
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= -9e+153: tmp_2 = 0 if b >= 0.0: tmp_2 = b / a else: tmp_2 = b / -a tmp_1 = tmp_2 elif b <= 1.4e-71: tmp_3 = 0 if b >= 0.0: tmp_3 = (2.0 * c) * (-1.0 / (b + math.sqrt((c * (a * -4.0))))) else: tmp_3 = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0) tmp_1 = tmp_3 elif b >= 0.0: tmp_1 = (2.0 * c) / (2.0 * ((a * (c / b)) - b)) else: tmp_1 = (b * -2.0) / (a * 2.0) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= -9e+153) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(b / a); else tmp_2 = Float64(b / Float64(-a)); end tmp_1 = tmp_2; elseif (b <= 1.4e-71) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = Float64(Float64(2.0 * c) * Float64(-1.0 / Float64(b + sqrt(Float64(c * Float64(a * -4.0)))))); else tmp_3 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)); end tmp_1 = tmp_3; elseif (b >= 0.0) tmp_1 = Float64(Float64(2.0 * c) / Float64(2.0 * Float64(Float64(a * Float64(c / b)) - b))); else tmp_1 = Float64(Float64(b * -2.0) / Float64(a * 2.0)); end return tmp_1 end
function tmp_5 = code(a, b, c) tmp_2 = 0.0; if (b <= -9e+153) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = b / a; else tmp_3 = b / -a; end tmp_2 = tmp_3; elseif (b <= 1.4e-71) tmp_4 = 0.0; if (b >= 0.0) tmp_4 = (2.0 * c) * (-1.0 / (b + sqrt((c * (a * -4.0))))); else tmp_4 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0); end tmp_2 = tmp_4; elseif (b >= 0.0) tmp_2 = (2.0 * c) / (2.0 * ((a * (c / b)) - b)); else tmp_2 = (b * -2.0) / (a * 2.0); end tmp_5 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, -9e+153], If[GreaterEqual[b, 0.0], N[(b / a), $MachinePrecision], N[(b / (-a)), $MachinePrecision]], If[LessEqual[b, 1.4e-71], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] * N[(-1.0 / N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[(2.0 * N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9 \cdot 10^{+153}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}\\
\mathbf{elif}\;b \leq 1.4 \cdot 10^{-71}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\left(2 \cdot c\right) \cdot \frac{-1}{b + \sqrt{c \cdot \left(a \cdot -4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot \left(a \cdot \frac{c}{b} - b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 2}\\
\end{array}
\end{array}
if b < -9.0000000000000002e153Initial program 37.7%
Taylor expanded in b around -inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in a around 0 100.0%
distribute-lft-out--100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in b around 0 100.0%
*-commutative100.0%
associate-*r/100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in c around inf 100.0%
if -9.0000000000000002e153 < b < 1.4e-71Initial program 82.9%
add-sqr-sqrt82.8%
pow282.8%
pow1/282.8%
sqrt-pow182.8%
fmm-def82.8%
*-commutative82.8%
distribute-rgt-neg-in82.8%
distribute-lft-neg-in82.8%
metadata-eval82.8%
*-commutative82.8%
metadata-eval82.8%
Applied egg-rr82.8%
Taylor expanded in b around 0 79.7%
*-commutative79.7%
*-commutative79.7%
associate-*r*79.7%
Simplified79.7%
div-inv79.7%
pow-pow79.8%
metadata-eval79.8%
pow1/279.8%
Applied egg-rr79.8%
if 1.4e-71 < b Initial program 69.7%
Taylor expanded in b around -inf 69.7%
*-commutative69.7%
Simplified69.7%
Taylor expanded in a around 0 86.2%
distribute-lft-out--86.2%
associate-/l*89.0%
Simplified89.0%
Final simplification86.4%
(FPCore (a b c)
:precision binary64
(if (<= b -2.65e-39)
(if (>= b 0.0) (/ b a) (/ b (- a)))
(if (>= b 0.0)
(/ (* 2.0 c) (* 2.0 (fma a (/ c b) (- b))))
(/ (- (sqrt (* c (* a -4.0))) b) (* a 2.0)))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= -2.65e-39) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = b / a;
} else {
tmp_2 = b / -a;
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = (2.0 * c) / (2.0 * fma(a, (c / b), -b));
} else {
tmp_1 = (sqrt((c * (a * -4.0))) - b) / (a * 2.0);
}
return tmp_1;
}
function code(a, b, c) tmp_1 = 0.0 if (b <= -2.65e-39) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(b / a); else tmp_2 = Float64(b / Float64(-a)); end tmp_1 = tmp_2; elseif (b >= 0.0) tmp_1 = Float64(Float64(2.0 * c) / Float64(2.0 * fma(a, Float64(c / b), Float64(-b)))); else tmp_1 = Float64(Float64(sqrt(Float64(c * Float64(a * -4.0))) - b) / Float64(a * 2.0)); end return tmp_1 end
code[a_, b_, c_] := If[LessEqual[b, -2.65e-39], If[GreaterEqual[b, 0.0], N[(b / a), $MachinePrecision], N[(b / (-a)), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[(2.0 * N[(a * N[(c / b), $MachinePrecision] + (-b)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.65 \cdot 10^{-39}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\
\end{array}
\end{array}
if b < -2.65000000000000002e-39Initial program 66.4%
Taylor expanded in b around -inf 85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in a around 0 85.5%
distribute-lft-out--85.5%
associate-/l*85.5%
Simplified85.5%
Taylor expanded in b around 0 85.5%
*-commutative85.5%
associate-*r/85.5%
neg-mul-185.5%
Simplified85.5%
Taylor expanded in c around inf 85.5%
if -2.65000000000000002e-39 < b Initial program 73.1%
Taylor expanded in a around 0 73.5%
distribute-lft-out--73.5%
associate-/l*75.2%
fmm-def75.2%
Simplified75.2%
Taylor expanded in b around 0 73.4%
*-commutative73.4%
*-commutative73.4%
associate-*r*73.4%
Simplified73.4%
Final simplification77.2%
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ c (- (* c (/ a b)) b)) (/ b (- a))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = c / ((c * (a / b)) - b);
} else {
tmp = b / -a;
}
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 >= 0.0d0) then
tmp = c / ((c * (a / b)) - b)
else
tmp = b / -a
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = c / ((c * (a / b)) - b);
} else {
tmp = b / -a;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = c / ((c * (a / b)) - b) else: tmp = b / -a return tmp
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(c / Float64(Float64(c * Float64(a / b)) - b)); else tmp = Float64(b / Float64(-a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b >= 0.0) tmp = c / ((c * (a / b)) - b); else tmp = b / -a; end tmp_2 = tmp; end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(c / N[(N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[(b / (-a)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c}{c \cdot \frac{a}{b} - b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}
\end{array}
Initial program 71.0%
Taylor expanded in b around -inf 66.4%
*-commutative66.4%
Simplified66.4%
Taylor expanded in a around 0 66.6%
distribute-lft-out--66.6%
associate-/l*67.8%
Simplified67.8%
Taylor expanded in b around 0 66.6%
*-commutative66.6%
associate-*r/66.6%
neg-mul-166.6%
Simplified66.6%
associate-/l*67.9%
Applied egg-rr67.9%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ c (- b)) (/ b (- a))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = c / -b;
} else {
tmp = b / -a;
}
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 >= 0.0d0) then
tmp = c / -b
else
tmp = b / -a
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = c / -b;
} else {
tmp = b / -a;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = c / -b else: tmp = b / -a return tmp
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(c / Float64(-b)); else tmp = Float64(b / Float64(-a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b >= 0.0) tmp = c / -b; else tmp = b / -a; end tmp_2 = tmp; end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(c / (-b)), $MachinePrecision], N[(b / (-a)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c}{-b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}
\end{array}
Initial program 71.0%
Taylor expanded in b around -inf 66.4%
*-commutative66.4%
Simplified66.4%
Taylor expanded in a around 0 66.6%
distribute-lft-out--66.6%
associate-/l*67.8%
Simplified67.8%
Taylor expanded in b around 0 66.6%
*-commutative66.6%
associate-*r/66.6%
neg-mul-166.6%
Simplified66.6%
Taylor expanded in c around 0 67.2%
neg-mul-167.2%
Simplified67.2%
Final simplification67.2%
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ b a) (/ b (- a))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = b / a;
} else {
tmp = b / -a;
}
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 >= 0.0d0) then
tmp = b / a
else
tmp = b / -a
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = b / a;
} else {
tmp = b / -a;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = b / a else: tmp = b / -a return tmp
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(b / a); else tmp = Float64(b / Float64(-a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b >= 0.0) tmp = b / a; else tmp = b / -a; end tmp_2 = tmp; end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(b / a), $MachinePrecision], N[(b / (-a)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{-a}\\
\end{array}
\end{array}
Initial program 71.0%
Taylor expanded in b around -inf 66.4%
*-commutative66.4%
Simplified66.4%
Taylor expanded in a around 0 66.6%
distribute-lft-out--66.6%
associate-/l*67.8%
Simplified67.8%
Taylor expanded in b around 0 66.6%
*-commutative66.6%
associate-*r/66.6%
neg-mul-166.6%
Simplified66.6%
Taylor expanded in c around inf 31.4%
Final simplification31.4%
herbie shell --seed 2024182
(FPCore (a b c)
:name "jeff quadratic root 2"
:precision binary64
(if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))