| Alternative 1 | |
|---|---|
| Error | 10.96% |
| Cost | 38052 |
(FPCore (a b c) :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))))
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (* 2.0 c) (- (- b) b)))
(t_1 (sqrt (+ (* b b) (* c (* a -4.0)))))
(t_2 (/ (- t_1 b) (* 2.0 a)))
(t_3 (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_1)) t_2)))
(if (<= t_3 (- INFINITY))
(if (>= b 0.0) t_0 (/ (- b) a))
(if (<= t_3 -4e-218)
(if (>= b 0.0)
(/ (* 2.0 c) (- (/ -1.0 (pow (fma c (* a -4.0) (* b b)) -0.5)) b))
t_2)
(if (<= t_3 0.0)
(if (>= b 0.0) (/ (* 2.0 c) (fma 2.0 (* a (/ c b)) (* b -2.0))) t_2)
(if (<= t_3 1e+205) t_3 (if (>= b 0.0) t_0 (- (/ c b) (/ b a)))))))))double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c))));
} else {
tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
return tmp;
}
double code(double a, double b, double c) {
double t_0 = (2.0 * c) / (-b - b);
double t_1 = sqrt(((b * b) + (c * (a * -4.0))));
double t_2 = (t_1 - b) / (2.0 * a);
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_1);
} else {
tmp = t_2;
}
double t_3 = tmp;
double tmp_2;
if (t_3 <= -((double) INFINITY)) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = t_0;
} else {
tmp_3 = -b / a;
}
tmp_2 = tmp_3;
} else if (t_3 <= -4e-218) {
double tmp_4;
if (b >= 0.0) {
tmp_4 = (2.0 * c) / ((-1.0 / pow(fma(c, (a * -4.0), (b * b)), -0.5)) - b);
} else {
tmp_4 = t_2;
}
tmp_2 = tmp_4;
} else if (t_3 <= 0.0) {
double tmp_5;
if (b >= 0.0) {
tmp_5 = (2.0 * c) / fma(2.0, (a * (c / b)), (b * -2.0));
} else {
tmp_5 = t_2;
}
tmp_2 = tmp_5;
} else if (t_3 <= 1e+205) {
tmp_2 = t_3;
} else if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = (c / b) - (b / a);
}
return tmp_2;
}
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))))); else tmp = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)); end return tmp end
function code(a, b, c) t_0 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - b)) t_1 = sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -4.0)))) t_2 = Float64(Float64(t_1 - b) / Float64(2.0 * a)) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_1)); else tmp = t_2; end t_3 = tmp tmp_2 = 0.0 if (t_3 <= Float64(-Inf)) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = t_0; else tmp_3 = Float64(Float64(-b) / a); end tmp_2 = tmp_3; elseif (t_3 <= -4e-218) tmp_4 = 0.0 if (b >= 0.0) tmp_4 = Float64(Float64(2.0 * c) / Float64(Float64(-1.0 / (fma(c, Float64(a * -4.0), Float64(b * b)) ^ -0.5)) - b)); else tmp_4 = t_2; end tmp_2 = tmp_4; elseif (t_3 <= 0.0) tmp_5 = 0.0 if (b >= 0.0) tmp_5 = Float64(Float64(2.0 * c) / fma(2.0, Float64(a * Float64(c / b)), Float64(b * -2.0))); else tmp_5 = t_2; end tmp_2 = tmp_5; elseif (t_3 <= 1e+205) tmp_2 = t_3; elseif (b >= 0.0) tmp_2 = t_0; else tmp_2 = Float64(Float64(c / b) - Float64(b / a)); end return tmp_2 end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]]
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]}, If[LessEqual[t$95$3, (-Infinity)], If[GreaterEqual[b, 0.0], t$95$0, N[((-b) / a), $MachinePrecision]], If[LessEqual[t$95$3, -4e-218], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[(N[(-1.0 / N[Power[N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], t$95$2], If[LessEqual[t$95$3, 0.0], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[(2.0 * N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(b * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2], If[LessEqual[t$95$3, 1e+205], t$95$3, If[GreaterEqual[b, 0.0], t$95$0, N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\begin{array}{l}
t_0 := \frac{2 \cdot c}{\left(-b\right) - b}\\
t_1 := \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\\
t_2 := \frac{t_1 - b}{2 \cdot a}\\
t_3 := \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t_1}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\
\end{array}\\
\mathbf{elif}\;t_3 \leq -4 \cdot 10^{-218}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\frac{-1}{{\left(\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\right)}^{-0.5}} - b}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}\\
\mathbf{elif}\;t_3 \leq 0:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\mathsf{fma}\left(2, a \cdot \frac{c}{b}, b \cdot -2\right)}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}\\
\mathbf{elif}\;t_3 \leq 10^{+205}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}
if (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) < -inf.0Initial program 100
Taylor expanded in b around inf 100
Taylor expanded in b around -inf 25.58
Simplified25.58
[Start]25.58 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{b}{a}\\
\end{array}
\] |
|---|---|
mul-1-neg [=>]25.58 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;-\frac{b}{a}\\
\end{array}
\] |
distribute-neg-frac [=>]25.58 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\
\end{array}
\] |
if -inf.0 < (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) < -4.0000000000000001e-218Initial program 4.68
Applied egg-rr24.08
Simplified25.27
[Start]24.08 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\frac{{b}^{4} - \left(c \cdot \left(a \cdot -4\right)\right) \cdot \left(c \cdot \left(a \cdot -4\right)\right)}{b \cdot b - c \cdot \left(a \cdot -4\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
|---|---|
associate-*l* [=>]25.27 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\frac{{b}^{4} - \color{blue}{c \cdot \left(\left(a \cdot -4\right) \cdot \left(c \cdot \left(a \cdot -4\right)\right)\right)}}{b \cdot b - c \cdot \left(a \cdot -4\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
Applied egg-rr4.95
Simplified5.05
[Start]4.95 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \frac{1}{\sqrt{\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
|---|---|
fma-def [<=]4.95 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \frac{1}{\sqrt{\frac{1}{\color{blue}{b \cdot b + c \cdot \left(a \cdot -4\right)}}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
+-commutative [=>]4.95 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \frac{1}{\sqrt{\frac{1}{\color{blue}{c \cdot \left(a \cdot -4\right) + b \cdot b}}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
fma-def [=>]5.05 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \frac{1}{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
*-commutative [=>]5.05 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \frac{1}{\sqrt{\frac{1}{\mathsf{fma}\left(c, \color{blue}{-4 \cdot a}, b \cdot b\right)}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
Applied egg-rr30.76
Simplified4.72
[Start]30.76 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \frac{1}{e^{\mathsf{log1p}\left({\left(\mathsf{fma}\left(c, -4 \cdot a, b \cdot b\right)\right)}^{-0.5}\right)} - 1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
|---|---|
expm1-def [=>]5.65 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \frac{1}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\mathsf{fma}\left(c, -4 \cdot a, b \cdot b\right)\right)}^{-0.5}\right)\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
expm1-log1p [=>]4.72 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \frac{1}{\color{blue}{{\left(\mathsf{fma}\left(c, -4 \cdot a, b \cdot b\right)\right)}^{-0.5}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
*-commutative [=>]4.72 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \frac{1}{{\left(\mathsf{fma}\left(c, \color{blue}{a \cdot -4}, b \cdot b\right)\right)}^{-0.5}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
if -4.0000000000000001e-218 < (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) < 0.0Initial program 52.92
Taylor expanded in b around inf 19.52
Simplified15.71
[Start]19.52 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot \frac{c \cdot a}{b} + -2 \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
|---|---|
fma-def [=>]19.52 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\color{blue}{\mathsf{fma}\left(2, \frac{c \cdot a}{b}, -2 \cdot b\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
associate-/l* [=>]15.71 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\mathsf{fma}\left(2, \color{blue}{\frac{c}{\frac{b}{a}}}, -2 \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
associate-/r/ [=>]15.71 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\mathsf{fma}\left(2, \color{blue}{\frac{c}{b} \cdot a}, -2 \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
*-commutative [=>]15.71 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\mathsf{fma}\left(2, \frac{c}{b} \cdot a, \color{blue}{b \cdot -2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
if 0.0 < (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) < 1.00000000000000002e205Initial program 4.39
Applied egg-rr27.02
Simplified28.86
[Start]27.02 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\frac{{b}^{4} - \left(c \cdot \left(a \cdot -4\right)\right) \cdot \left(c \cdot \left(a \cdot -4\right)\right)}{b \cdot b - c \cdot \left(a \cdot -4\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
|---|---|
associate-*l* [=>]28.86 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\frac{{b}^{4} - \color{blue}{c \cdot \left(\left(a \cdot -4\right) \cdot \left(c \cdot \left(a \cdot -4\right)\right)\right)}}{b \cdot b - c \cdot \left(a \cdot -4\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\] |
Applied egg-rr4.39
if 1.00000000000000002e205 < (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) Initial program 73.5
Taylor expanded in b around inf 70.15
Taylor expanded in b around -inf 24.23
Simplified24.23
[Start]24.23 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} + -1 \cdot \frac{b}{a}\\
\end{array}
\] |
|---|---|
mul-1-neg [=>]24.23 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\color{blue}{\frac{c}{b} + \left(-\frac{b}{a}\right)}\\
\end{array}
\] |
unsub-neg [=>]24.23 | \[ \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}
\] |
Final simplification10.98
| Alternative 1 | |
|---|---|
| Error | 10.96% |
| Cost | 38052 |
| Alternative 2 | |
|---|---|
| Error | 15.46% |
| Cost | 7888 |
| Alternative 3 | |
|---|---|
| Error | 10.77% |
| Cost | 7888 |
| Alternative 4 | |
|---|---|
| Error | 10.71% |
| Cost | 7820 |
| Alternative 5 | |
|---|---|
| Error | 20.48% |
| Cost | 7632 |
| Alternative 6 | |
|---|---|
| Error | 27.68% |
| Cost | 7368 |
| Alternative 7 | |
|---|---|
| Error | 34.37% |
| Cost | 644 |
herbie shell --seed 2023102
(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))))