| Alternative 1 | |
|---|---|
| Error | 4.74% |
| Cost | 35780 |
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma c (* a -4.0) (* b b))))
(if (<= (/ (- (sqrt (+ (* b b) (* c (* a -4.0)))) b) (* a 2.0)) -0.08)
(/
(*
(/ (* c (* 4.0 a)) (+ b (sqrt t_0)))
(/ (- (* b b) (fma b b (* a (* 4.0 c)))) (- (* b b) t_0)))
(* a 2.0))
(-
(-
(fma
-0.25
(/ (pow a 3.0) (/ (pow b 7.0) (* (pow c 4.0) 20.0)))
(/ (* (* a (* a -2.0)) (pow c 3.0)) (pow b 5.0)))
(/ c b))
(* a (* (/ c b) (/ c (* b b))))))))double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
double code(double a, double b, double c) {
double t_0 = fma(c, (a * -4.0), (b * b));
double tmp;
if (((sqrt(((b * b) + (c * (a * -4.0)))) - b) / (a * 2.0)) <= -0.08) {
tmp = (((c * (4.0 * a)) / (b + sqrt(t_0))) * (((b * b) - fma(b, b, (a * (4.0 * c)))) / ((b * b) - t_0))) / (a * 2.0);
} else {
tmp = (fma(-0.25, (pow(a, 3.0) / (pow(b, 7.0) / (pow(c, 4.0) * 20.0))), (((a * (a * -2.0)) * pow(c, 3.0)) / pow(b, 5.0))) - (c / b)) - (a * ((c / b) * (c / (b * b))));
}
return tmp;
}
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 code(a, b, c) t_0 = fma(c, Float64(a * -4.0), Float64(b * b)) tmp = 0.0 if (Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -4.0)))) - b) / Float64(a * 2.0)) <= -0.08) tmp = Float64(Float64(Float64(Float64(c * Float64(4.0 * a)) / Float64(b + sqrt(t_0))) * Float64(Float64(Float64(b * b) - fma(b, b, Float64(a * Float64(4.0 * c)))) / Float64(Float64(b * b) - t_0))) / Float64(a * 2.0)); else tmp = Float64(Float64(fma(-0.25, Float64((a ^ 3.0) / Float64((b ^ 7.0) / Float64((c ^ 4.0) * 20.0))), Float64(Float64(Float64(a * Float64(a * -2.0)) * (c ^ 3.0)) / (b ^ 5.0))) - Float64(c / b)) - Float64(a * Float64(Float64(c / b) * Float64(c / Float64(b * b))))); end return tmp 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]
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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], -0.08], N[(N[(N[(N[(c * N[(4.0 * a), $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(b * b), $MachinePrecision] - N[(b * b + N[(a * N[(4.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(b * b), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.25 * N[(N[Power[a, 3.0], $MachinePrecision] / N[(N[Power[b, 7.0], $MachinePrecision] / N[(N[Power[c, 4.0], $MachinePrecision] * 20.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(a * N[(a * -2.0), $MachinePrecision]), $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision] - N[(a * N[(N[(c / b), $MachinePrecision] * N[(c / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
t_0 := \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2} \leq -0.08:\\
\;\;\;\;\frac{\frac{c \cdot \left(4 \cdot a\right)}{b + \sqrt{t_0}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - t_0}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.25, \frac{{a}^{3}}{\frac{{b}^{7}}{{c}^{4} \cdot 20}}, \frac{\left(a \cdot \left(a \cdot -2\right)\right) \cdot {c}^{3}}{{b}^{5}}\right) - \frac{c}{b}\right) - a \cdot \left(\frac{c}{b} \cdot \frac{c}{b \cdot b}\right)\\
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) < -0.0800000000000000017Initial program 30.64
Simplified30.64
[Start]30.64 | \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\] |
|---|---|
*-commutative [=>]30.64 | \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}}
\] |
Applied egg-rr31.02
Simplified31.05
[Start]31.02 | \[ \frac{\frac{\frac{b \cdot b - \mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{\frac{1}{b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}}}{a \cdot 2}
\] |
|---|---|
associate-/r/ [=>]31.02 | \[ \frac{\color{blue}{\frac{\frac{b \cdot b - \mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{1} \cdot \left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right)}}{a \cdot 2}
\] |
*-commutative [=>]31.02 | \[ \frac{\color{blue}{\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{\frac{b \cdot b - \mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{1}}}{a \cdot 2}
\] |
fma-def [<=]31.66 | \[ \frac{\left(b - \sqrt{\color{blue}{b \cdot b + c \cdot \left(a \cdot -4\right)}}\right) \cdot \frac{\frac{b \cdot b - \mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{1}}{a \cdot 2}
\] |
+-commutative [=>]31.66 | \[ \frac{\left(b - \sqrt{\color{blue}{c \cdot \left(a \cdot -4\right) + b \cdot b}}\right) \cdot \frac{\frac{b \cdot b - \mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{1}}{a \cdot 2}
\] |
fma-def [=>]31.65 | \[ \frac{\left(b - \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\right) \cdot \frac{\frac{b \cdot b - \mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{1}}{a \cdot 2}
\] |
/-rgt-identity [=>]31.65 | \[ \frac{\left(b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\right) \cdot \color{blue}{\frac{b \cdot b - \mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}}{a \cdot 2}
\] |
/-rgt-identity [<=]31.65 | \[ \frac{\left(b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\right) \cdot \frac{\color{blue}{\frac{b \cdot b - \mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right)}{1}}}{b \cdot b - \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{a \cdot 2}
\] |
/-rgt-identity [=>]31.65 | \[ \frac{\left(b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\right) \cdot \frac{\color{blue}{b \cdot b - \mathsf{fma}\left(b, b, 4 \cdot \left(a \cdot c\right)\right)}}{b \cdot b - \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{a \cdot 2}
\] |
associate-*r* [=>]31.65 | \[ \frac{\left(b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\right) \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, \color{blue}{\left(4 \cdot a\right) \cdot c}\right)}{b \cdot b - \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{a \cdot 2}
\] |
*-commutative [=>]31.65 | \[ \frac{\left(b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\right) \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, \color{blue}{\left(a \cdot 4\right)} \cdot c\right)}{b \cdot b - \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{a \cdot 2}
\] |
associate-*l* [=>]31.65 | \[ \frac{\left(b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\right) \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, \color{blue}{a \cdot \left(4 \cdot c\right)}\right)}{b \cdot b - \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{a \cdot 2}
\] |
Applied egg-rr29.45
Simplified8.89
[Start]29.45 | \[ \frac{\left(\left(b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\right) \cdot \frac{1}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\right) \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
|---|---|
associate-*r/ [=>]29.45 | \[ \frac{\color{blue}{\frac{\left(b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\right) \cdot 1}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
*-rgt-identity [=>]29.45 | \[ \frac{\frac{\color{blue}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
fma-udef [=>]29.47 | \[ \frac{\frac{b \cdot b - \color{blue}{\left(c \cdot \left(a \cdot -4\right) + b \cdot b\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
associate-*l* [<=]29.47 | \[ \frac{\frac{b \cdot b - \left(\color{blue}{\left(c \cdot a\right) \cdot -4} + b \cdot b\right)}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
associate--r+ [=>]29.47 | \[ \frac{\frac{\color{blue}{\left(b \cdot b - \left(c \cdot a\right) \cdot -4\right) - b \cdot b}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
unsub-neg [<=]29.47 | \[ \frac{\frac{\color{blue}{\left(b \cdot b + \left(-\left(c \cdot a\right) \cdot -4\right)\right)} - b \cdot b}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
unsub-neg [<=]29.47 | \[ \frac{\frac{\color{blue}{\left(b \cdot b + \left(-\left(c \cdot a\right) \cdot -4\right)\right) + \left(-b \cdot b\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
+-commutative [=>]29.47 | \[ \frac{\frac{\color{blue}{\left(-b \cdot b\right) + \left(b \cdot b + \left(-\left(c \cdot a\right) \cdot -4\right)\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
associate-+r+ [=>]8.89 | \[ \frac{\frac{\color{blue}{\left(\left(-b \cdot b\right) + b \cdot b\right) + \left(-\left(c \cdot a\right) \cdot -4\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
+-commutative [<=]8.89 | \[ \frac{\frac{\color{blue}{\left(b \cdot b + \left(-b \cdot b\right)\right)} + \left(-\left(c \cdot a\right) \cdot -4\right)}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
unsub-neg [=>]8.89 | \[ \frac{\frac{\color{blue}{\left(b \cdot b - b \cdot b\right)} + \left(-\left(c \cdot a\right) \cdot -4\right)}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
+-inverses [=>]8.89 | \[ \frac{\frac{\color{blue}{0} + \left(-\left(c \cdot a\right) \cdot -4\right)}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
sub-neg [<=]8.89 | \[ \frac{\frac{\color{blue}{0 - \left(c \cdot a\right) \cdot -4}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
neg-sub0 [<=]8.89 | \[ \frac{\frac{\color{blue}{-\left(c \cdot a\right) \cdot -4}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
distribute-rgt-neg-in [=>]8.89 | \[ \frac{\frac{\color{blue}{\left(c \cdot a\right) \cdot \left(--4\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
metadata-eval [=>]8.89 | \[ \frac{\frac{\left(c \cdot a\right) \cdot \color{blue}{4}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
associate-*l* [=>]8.89 | \[ \frac{\frac{\color{blue}{c \cdot \left(a \cdot 4\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
*-commutative [=>]8.89 | \[ \frac{\frac{c \cdot \left(a \cdot 4\right)}{b + \sqrt{\mathsf{fma}\left(c, \color{blue}{-4 \cdot a}, b \cdot b\right)}} \cdot \frac{b \cdot b - \mathsf{fma}\left(b, b, a \cdot \left(4 \cdot c\right)\right)}{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot 2}
\] |
if -0.0800000000000000017 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) Initial program 75.54
Simplified75.54
[Start]75.54 | \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\] |
|---|---|
*-commutative [=>]75.54 | \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}}
\] |
Taylor expanded in a around 0 2.89
Simplified2.89
[Start]2.89 | \[ -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + \left(-1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{a}^{3} \cdot \left(16 \cdot \frac{{c}^{4}}{{b}^{6}} + {\left(-2 \cdot \frac{{c}^{2}}{{b}^{3}}\right)}^{2}\right)}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right)
\] |
|---|---|
+-commutative [=>]2.89 | \[ \color{blue}{\left(-1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{a}^{3} \cdot \left(16 \cdot \frac{{c}^{4}}{{b}^{6}} + {\left(-2 \cdot \frac{{c}^{2}}{{b}^{3}}\right)}^{2}\right)}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}}
\] |
mul-1-neg [=>]2.89 | \[ \left(-1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{a}^{3} \cdot \left(16 \cdot \frac{{c}^{4}}{{b}^{6}} + {\left(-2 \cdot \frac{{c}^{2}}{{b}^{3}}\right)}^{2}\right)}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) + \color{blue}{\left(-\frac{{c}^{2} \cdot a}{{b}^{3}}\right)}
\] |
unsub-neg [=>]2.89 | \[ \color{blue}{\left(-1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{a}^{3} \cdot \left(16 \cdot \frac{{c}^{4}}{{b}^{6}} + {\left(-2 \cdot \frac{{c}^{2}}{{b}^{3}}\right)}^{2}\right)}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) - \frac{{c}^{2} \cdot a}{{b}^{3}}}
\] |
Taylor expanded in b around 0 2.89
Simplified2.89
[Start]2.89 | \[ \left(\mathsf{fma}\left(-0.25, \frac{{a}^{3} \cdot \left(4 \cdot {c}^{4} + 16 \cdot {c}^{4}\right)}{{b}^{7}}, \frac{\left(\left(a \cdot -2\right) \cdot a\right) \cdot {c}^{3}}{{b}^{5}}\right) - \frac{c}{b}\right) - \frac{c \cdot c}{{b}^{3}} \cdot a
\] |
|---|---|
associate-/l* [=>]2.89 | \[ \left(\mathsf{fma}\left(-0.25, \color{blue}{\frac{{a}^{3}}{\frac{{b}^{7}}{4 \cdot {c}^{4} + 16 \cdot {c}^{4}}}}, \frac{\left(\left(a \cdot -2\right) \cdot a\right) \cdot {c}^{3}}{{b}^{5}}\right) - \frac{c}{b}\right) - \frac{c \cdot c}{{b}^{3}} \cdot a
\] |
distribute-rgt-out [=>]2.89 | \[ \left(\mathsf{fma}\left(-0.25, \frac{{a}^{3}}{\frac{{b}^{7}}{\color{blue}{{c}^{4} \cdot \left(4 + 16\right)}}}, \frac{\left(\left(a \cdot -2\right) \cdot a\right) \cdot {c}^{3}}{{b}^{5}}\right) - \frac{c}{b}\right) - \frac{c \cdot c}{{b}^{3}} \cdot a
\] |
metadata-eval [=>]2.89 | \[ \left(\mathsf{fma}\left(-0.25, \frac{{a}^{3}}{\frac{{b}^{7}}{{c}^{4} \cdot \color{blue}{20}}}, \frac{\left(\left(a \cdot -2\right) \cdot a\right) \cdot {c}^{3}}{{b}^{5}}\right) - \frac{c}{b}\right) - \frac{c \cdot c}{{b}^{3}} \cdot a
\] |
Applied egg-rr2.89
Final simplification3.9
| Alternative 1 | |
|---|---|
| Error | 4.74% |
| Cost | 35780 |
| Alternative 2 | |
|---|---|
| Error | 9.24% |
| Cost | 22020 |
| Alternative 3 | |
|---|---|
| Error | 9.21% |
| Cost | 21060 |
| Alternative 4 | |
|---|---|
| Error | 6.35% |
| Cost | 20736 |
| Alternative 5 | |
|---|---|
| Error | 9.21% |
| Cost | 14788 |
| Alternative 6 | |
|---|---|
| Error | 9.6% |
| Cost | 1024 |
| Alternative 7 | |
|---|---|
| Error | 19.16% |
| Cost | 256 |
| Alternative 8 | |
|---|---|
| Error | 98.36% |
| Cost | 192 |
herbie shell --seed 2023121
(FPCore (a b c)
:name "Quadratic roots, medium range"
:precision binary64
:pre (and (and (and (< 1.1102230246251565e-16 a) (< a 9007199254740992.0)) (and (< 1.1102230246251565e-16 b) (< b 9007199254740992.0))) (and (< 1.1102230246251565e-16 c) (< c 9007199254740992.0)))
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))