| Alternative 1 | |
|---|---|
| Error | 6.6 |
| 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 (if (>= b 0.0) (/ (* 2.0 c) (- (- b) b)) (- (/ c b) (/ b a))))
(t_1 (/ (* 2.0 c) (- (- b) (sqrt (+ (* b b) (* c (* a -4.0))))))))
(if (<= b -1.5e+154)
t_0
(if (<= b -5e-34)
(if (>= b 0.0)
t_1
(/
(-
(sqrt
(+
(fma c (* a -4.0) (* b b))
(* 4.0 (fma (* a -4.0) c (* a (* c 4.0))))))
b)
(* 2.0 a)))
(if (<= b 5e+149)
(if (>= b 0.0)
t_1
(/
(- (hypot b (pow (* (cbrt (* a -4.0)) (cbrt c)) 1.5)) b)
(* 2.0 a)))
t_0)))))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 tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - b);
} else {
tmp = (c / b) - (b / a);
}
double t_0 = tmp;
double t_1 = (2.0 * c) / (-b - sqrt(((b * b) + (c * (a * -4.0)))));
double tmp_1;
if (b <= -1.5e+154) {
tmp_1 = t_0;
} else if (b <= -5e-34) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_1;
} else {
tmp_2 = (sqrt((fma(c, (a * -4.0), (b * b)) + (4.0 * fma((a * -4.0), c, (a * (c * 4.0)))))) - b) / (2.0 * a);
}
tmp_1 = tmp_2;
} else if (b <= 5e+149) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = t_1;
} else {
tmp_3 = (hypot(b, pow((cbrt((a * -4.0)) * cbrt(c)), 1.5)) - b) / (2.0 * a);
}
tmp_1 = tmp_3;
} else {
tmp_1 = t_0;
}
return tmp_1;
}
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) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - b)); else tmp = Float64(Float64(c / b) - Float64(b / a)); end t_0 = tmp t_1 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -4.0)))))) tmp_1 = 0.0 if (b <= -1.5e+154) tmp_1 = t_0; elseif (b <= -5e-34) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = t_1; else tmp_2 = Float64(Float64(sqrt(Float64(fma(c, Float64(a * -4.0), Float64(b * b)) + Float64(4.0 * fma(Float64(a * -4.0), c, Float64(a * Float64(c * 4.0)))))) - b) / Float64(2.0 * a)); end tmp_1 = tmp_2; elseif (b <= 5e+149) tmp_3 = 0.0 if (b >= 0.0) tmp_3 = t_1; else tmp_3 = Float64(Float64(hypot(b, (Float64(cbrt(Float64(a * -4.0)) * cbrt(c)) ^ 1.5)) - b) / Float64(2.0 * a)); end tmp_1 = tmp_3; else tmp_1 = t_0; end return tmp_1 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 = If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - b), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]}, Block[{t$95$1 = N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.5e+154], t$95$0, If[LessEqual[b, -5e-34], If[GreaterEqual[b, 0.0], t$95$1, N[(N[(N[Sqrt[N[(N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(4.0 * N[(N[(a * -4.0), $MachinePrecision] * c + N[(a * N[(c * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 5e+149], If[GreaterEqual[b, 0.0], t$95$1, N[(N[(N[Sqrt[b ^ 2 + N[Power[N[(N[Power[N[(a * -4.0), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[c, 1/3], $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision] ^ 2], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], t$95$0]]]]]
\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 := \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}\\
t_1 := \frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}\\
\mathbf{if}\;b \leq -1.5 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b \leq -5 \cdot 10^{-34}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) + 4 \cdot \mathsf{fma}\left(a \cdot -4, c, a \cdot \left(c \cdot 4\right)\right)} - b}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \leq 5 \cdot 10^{+149}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{hypot}\left(b, {\left(\sqrt[3]{a \cdot -4} \cdot \sqrt[3]{c}\right)}^{1.5}\right) - b}{2 \cdot a}\\
\end{array}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
if b < -1.50000000000000013e154 or 4.9999999999999999e149 < b Initial program 48.0
Taylor expanded in b around inf 24.8
Taylor expanded in b around -inf 2.0
Simplified2.0
[Start]2.0 | \[ \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 [=>]2.0 | \[ \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 [=>]2.0 | \[ \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}
\] |
if -1.50000000000000013e154 < b < -5.0000000000000003e-34Initial program 5.4
Applied egg-rr5.4
Simplified5.4
[Start]5.4 | \[ \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{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right) + \left(\left(\left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right) + \left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right)\right) + \left(\left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right) + \left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right)\right)\right)}}{2 \cdot a}\\
\end{array}
\] |
|---|---|
fma-def [<=]5.4 | \[ \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{\left(b \cdot b + c \cdot \left(a \cdot -4\right)\right) + \left(\left(\left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right) + \left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right)\right) + \left(\left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right) + \left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right)\right)\right)}}{2 \cdot a}\\
\end{array}
\] |
+-commutative [=>]5.4 | \[ \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{\left(c \cdot \left(a \cdot -4\right) + b \cdot b\right) + \left(\left(\left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right) + \left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right)\right) + \left(\left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right) + \left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right)\right)\right)}}{2 \cdot a}\\
\end{array}
\] |
fma-def [=>]5.4 | \[ \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{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) + \left(\left(\left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right) + \left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right)\right) + \left(\left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right) + \left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right)\right)\right)}}{2 \cdot a}\\
\end{array}
\] |
count-2 [=>]5.4 | \[ \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{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) + 2 \cdot \left(\left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right) + \left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right)\right)}}{2 \cdot a}\\
\end{array}
\] |
count-2 [=>]5.4 | \[ \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{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) + 2 \cdot \left(2 \cdot \left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right)\right)}}{2 \cdot a}\\
\end{array}
\] |
associate-*r* [=>]5.4 | \[ \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{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) + \left(2 \cdot 2\right) \cdot \left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right)}}{2 \cdot a}\\
\end{array}
\] |
metadata-eval [=>]5.4 | \[ \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{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) + 4 \cdot \left(4 \cdot \left(a \cdot c\right) + c \cdot \left(a \cdot -4\right)\right)}}{2 \cdot a}\\
\end{array}
\] |
+-commutative [=>]5.4 | \[ \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{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) + 4 \cdot \left(c \cdot \left(a \cdot -4\right) + 4 \cdot \left(a \cdot c\right)\right)}}{2 \cdot a}\\
\end{array}
\] |
*-commutative [=>]5.4 | \[ \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{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) + 4 \cdot \left(\left(a \cdot -4\right) \cdot c + 4 \cdot \left(a \cdot c\right)\right)}}{2 \cdot a}\\
\end{array}
\] |
fma-udef [<=]5.4 | \[ \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{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) + 4 \cdot \mathsf{fma}\left(a \cdot -4, c, 4 \cdot \left(a \cdot c\right)\right)}}{2 \cdot a}\\
\end{array}
\] |
*-commutative [=>]5.4 | \[ \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{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) + 4 \cdot \mathsf{fma}\left(a \cdot -4, c, 4 \cdot \left(c \cdot a\right)\right)}}{2 \cdot a}\\
\end{array}
\] |
associate-*r* [=>]5.4 | \[ \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{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) + 4 \cdot \mathsf{fma}\left(a \cdot -4, c, \left(4 \cdot c\right) \cdot a\right)}}{2 \cdot a}\\
\end{array}
\] |
if -5.0000000000000003e-34 < b < 4.9999999999999999e149Initial program 9.1
Applied egg-rr10.3
Applied egg-rr9.5
Applied egg-rr9.7
Simplified9.7
[Start]9.7 | \[ \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{\mathsf{hypot}\left(b, \sqrt{{\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{2}} \cdot \sqrt{\sqrt[3]{c \cdot \left(a \cdot -4\right)}}\right) - b}{2 \cdot a}\\
\end{array}
\] |
|---|---|
*-commutative [=>]9.7 | \[ \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{\mathsf{hypot}\left(b, \sqrt{\sqrt[3]{c \cdot \left(a \cdot -4\right)}} \cdot \sqrt{{\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{2}}\right) - b}{2 \cdot a}\\
\end{array}
\] |
unpow1/2 [<=]9.7 | \[ \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{\mathsf{hypot}\left(b, {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5} \cdot \sqrt{{\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{2}}\right) - b}{2 \cdot a}\\
\end{array}
\] |
sqr-pow [=>]9.7 | \[ \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{\mathsf{hypot}\left(b, {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5} \cdot \sqrt{{\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{\left(\frac{2}{2}\right)} \cdot {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{\left(\frac{2}{2}\right)}}\right) - b}{2 \cdot a}\\
\end{array}
\] |
rem-sqrt-square [=>]9.7 | \[ \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{\mathsf{hypot}\left(b, {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5} \cdot \left|{\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{\left(\frac{2}{2}\right)}\right|\right) - b}{2 \cdot a}\\
\end{array}
\] |
metadata-eval [=>]9.7 | \[ \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{\mathsf{hypot}\left(b, {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5} \cdot \left|{\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{1}\right|\right) - b}{2 \cdot a}\\
\end{array}
\] |
metadata-eval [<=]9.7 | \[ \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{\mathsf{hypot}\left(b, {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5} \cdot \left|{\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{\left(2 \cdot 0.5\right)}\right|\right) - b}{2 \cdot a}\\
\end{array}
\] |
pow-sqr [<=]9.7 | \[ \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{\mathsf{hypot}\left(b, {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5} \cdot \left|{\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5} \cdot {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5}\right|\right) - b}{2 \cdot a}\\
\end{array}
\] |
fabs-sqr [=>]9.7 | \[ \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{\mathsf{hypot}\left(b, {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5} \cdot \left({\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5} \cdot {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5}\right)\right) - b}{2 \cdot a}\\
\end{array}
\] |
pow-sqr [=>]9.7 | \[ \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{\mathsf{hypot}\left(b, {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5} \cdot {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{\left(2 \cdot 0.5\right)}\right) - b}{2 \cdot a}\\
\end{array}
\] |
metadata-eval [=>]9.7 | \[ \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{\mathsf{hypot}\left(b, {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5} \cdot {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{1}\right) - b}{2 \cdot a}\\
\end{array}
\] |
unpow1 [=>]9.7 | \[ \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{\mathsf{hypot}\left(b, {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{0.5} \cdot \sqrt[3]{c \cdot \left(a \cdot -4\right)}\right) - b}{2 \cdot a}\\
\end{array}
\] |
pow-plus [=>]9.7 | \[ \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{\mathsf{hypot}\left(b, {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{\left(0.5 + 1\right)}\right) - b}{2 \cdot a}\\
\end{array}
\] |
metadata-eval [=>]9.7 | \[ \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{\mathsf{hypot}\left(b, {\left(\sqrt[3]{c \cdot \left(a \cdot -4\right)}\right)}^{1.5}\right) - b}{2 \cdot a}\\
\end{array}
\] |
Applied egg-rr8.2
Final simplification6.0
| Alternative 1 | |
|---|---|
| Error | 6.6 |
| Cost | 38052 |
| Alternative 2 | |
|---|---|
| Error | 6.7 |
| Cost | 38052 |
| Alternative 3 | |
|---|---|
| Error | 10.4 |
| Cost | 7888 |
| Alternative 4 | |
|---|---|
| Error | 6.8 |
| Cost | 7888 |
| Alternative 5 | |
|---|---|
| Error | 13.6 |
| Cost | 7632 |
| Alternative 6 | |
|---|---|
| Error | 18.2 |
| Cost | 7368 |
| Alternative 7 | |
|---|---|
| Error | 23.2 |
| Cost | 644 |
| Alternative 8 | |
|---|---|
| Error | 23.2 |
| Cost | 644 |
herbie shell --seed 2023237
(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))))