| Alternative 1 | |
|---|---|
| Accuracy | 86.4% |
| Cost | 13968 |

(FPCore (a b_2 c) :precision binary64 (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
(FPCore (a b_2 c)
:precision binary64
(let* ((t_0 (* c (- a))) (t_1 (sqrt t_0)) (t_2 (/ (* -0.5 c) b_2)))
(if (<= b_2 -53000.0)
t_2
(if (<= b_2 -2.2e-67)
(/ (/ t_0 (- b_2 (hypot b_2 t_1))) a)
(if (<= b_2 -3e-81)
t_2
(if (<= b_2 5e-152)
(/ (- (- b_2) (hypot t_1 b_2)) a)
(if (<= b_2 4.5e+142)
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* c a)))) a)
(+
(* -2.0 (/ b_2 a))
(*
-0.5
(*
b_2
(-
(* 2.0 (/ (- c c) (pow b_2 2.0)))
(/ c (pow b_2 2.0)))))))))))))double code(double a, double b_2, double c) {
return (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a;
}
double code(double a, double b_2, double c) {
double t_0 = c * -a;
double t_1 = sqrt(t_0);
double t_2 = (-0.5 * c) / b_2;
double tmp;
if (b_2 <= -53000.0) {
tmp = t_2;
} else if (b_2 <= -2.2e-67) {
tmp = (t_0 / (b_2 - hypot(b_2, t_1))) / a;
} else if (b_2 <= -3e-81) {
tmp = t_2;
} else if (b_2 <= 5e-152) {
tmp = (-b_2 - hypot(t_1, b_2)) / a;
} else if (b_2 <= 4.5e+142) {
tmp = (-b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a;
} else {
tmp = (-2.0 * (b_2 / a)) + (-0.5 * (b_2 * ((2.0 * ((c - c) / pow(b_2, 2.0))) - (c / pow(b_2, 2.0)))));
}
return tmp;
}
public static double code(double a, double b_2, double c) {
return (-b_2 - Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
public static double code(double a, double b_2, double c) {
double t_0 = c * -a;
double t_1 = Math.sqrt(t_0);
double t_2 = (-0.5 * c) / b_2;
double tmp;
if (b_2 <= -53000.0) {
tmp = t_2;
} else if (b_2 <= -2.2e-67) {
tmp = (t_0 / (b_2 - Math.hypot(b_2, t_1))) / a;
} else if (b_2 <= -3e-81) {
tmp = t_2;
} else if (b_2 <= 5e-152) {
tmp = (-b_2 - Math.hypot(t_1, b_2)) / a;
} else if (b_2 <= 4.5e+142) {
tmp = (-b_2 - Math.sqrt(((b_2 * b_2) - (c * a)))) / a;
} else {
tmp = (-2.0 * (b_2 / a)) + (-0.5 * (b_2 * ((2.0 * ((c - c) / Math.pow(b_2, 2.0))) - (c / Math.pow(b_2, 2.0)))));
}
return tmp;
}
def code(a, b_2, c): return (-b_2 - math.sqrt(((b_2 * b_2) - (a * c)))) / a
def code(a, b_2, c): t_0 = c * -a t_1 = math.sqrt(t_0) t_2 = (-0.5 * c) / b_2 tmp = 0 if b_2 <= -53000.0: tmp = t_2 elif b_2 <= -2.2e-67: tmp = (t_0 / (b_2 - math.hypot(b_2, t_1))) / a elif b_2 <= -3e-81: tmp = t_2 elif b_2 <= 5e-152: tmp = (-b_2 - math.hypot(t_1, b_2)) / a elif b_2 <= 4.5e+142: tmp = (-b_2 - math.sqrt(((b_2 * b_2) - (c * a)))) / a else: tmp = (-2.0 * (b_2 / a)) + (-0.5 * (b_2 * ((2.0 * ((c - c) / math.pow(b_2, 2.0))) - (c / math.pow(b_2, 2.0))))) return tmp
function code(a, b_2, c) return Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a) end
function code(a, b_2, c) t_0 = Float64(c * Float64(-a)) t_1 = sqrt(t_0) t_2 = Float64(Float64(-0.5 * c) / b_2) tmp = 0.0 if (b_2 <= -53000.0) tmp = t_2; elseif (b_2 <= -2.2e-67) tmp = Float64(Float64(t_0 / Float64(b_2 - hypot(b_2, t_1))) / a); elseif (b_2 <= -3e-81) tmp = t_2; elseif (b_2 <= 5e-152) tmp = Float64(Float64(Float64(-b_2) - hypot(t_1, b_2)) / a); elseif (b_2 <= 4.5e+142) tmp = Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(b_2 * b_2) - Float64(c * a)))) / a); else tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(-0.5 * Float64(b_2 * Float64(Float64(2.0 * Float64(Float64(c - c) / (b_2 ^ 2.0))) - Float64(c / (b_2 ^ 2.0)))))); end return tmp end
function tmp = code(a, b_2, c) tmp = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a; end
function tmp_2 = code(a, b_2, c) t_0 = c * -a; t_1 = sqrt(t_0); t_2 = (-0.5 * c) / b_2; tmp = 0.0; if (b_2 <= -53000.0) tmp = t_2; elseif (b_2 <= -2.2e-67) tmp = (t_0 / (b_2 - hypot(b_2, t_1))) / a; elseif (b_2 <= -3e-81) tmp = t_2; elseif (b_2 <= 5e-152) tmp = (-b_2 - hypot(t_1, b_2)) / a; elseif (b_2 <= 4.5e+142) tmp = (-b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a; else tmp = (-2.0 * (b_2 / a)) + (-0.5 * (b_2 * ((2.0 * ((c - c) / (b_2 ^ 2.0))) - (c / (b_2 ^ 2.0))))); end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) - N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
code[a_, b$95$2_, c_] := Block[{t$95$0 = N[(c * (-a)), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision]}, If[LessEqual[b$95$2, -53000.0], t$95$2, If[LessEqual[b$95$2, -2.2e-67], N[(N[(t$95$0 / N[(b$95$2 - N[Sqrt[b$95$2 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, -3e-81], t$95$2, If[LessEqual[b$95$2, 5e-152], N[(N[((-b$95$2) - N[Sqrt[t$95$1 ^ 2 + b$95$2 ^ 2], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, 4.5e+142], N[(N[((-b$95$2) - N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(b$95$2 * N[(N[(2.0 * N[(N[(c - c), $MachinePrecision] / N[Power[b$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / N[Power[b$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
t_0 := c \cdot \left(-a\right)\\
t_1 := \sqrt{t_0}\\
t_2 := \frac{-0.5 \cdot c}{b_2}\\
\mathbf{if}\;b_2 \leq -53000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;b_2 \leq -2.2 \cdot 10^{-67}:\\
\;\;\;\;\frac{\frac{t_0}{b_2 - \mathsf{hypot}\left(b_2, t_1\right)}}{a}\\
\mathbf{elif}\;b_2 \leq -3 \cdot 10^{-81}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;b_2 \leq 5 \cdot 10^{-152}:\\
\;\;\;\;\frac{\left(-b_2\right) - \mathsf{hypot}\left(t_1, b_2\right)}{a}\\
\mathbf{elif}\;b_2 \leq 4.5 \cdot 10^{+142}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + -0.5 \cdot \left(b_2 \cdot \left(2 \cdot \frac{c - c}{{b_2}^{2}} - \frac{c}{{b_2}^{2}}\right)\right)\\
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
Results
if b_2 < -53000 or -2.2000000000000001e-67 < b_2 < -2.9999999999999999e-81Initial program 18.2%
Taylor expanded in b_2 around -inf 94.2%
Simplified94.2%
[Start]94.2 | \[ -0.5 \cdot \frac{c}{b_2}
\] |
|---|---|
associate-*r/ [=>]94.2 | \[ \color{blue}{\frac{-0.5 \cdot c}{b_2}}
\] |
if -53000 < b_2 < -2.2000000000000001e-67Initial program 59.6%
Applied egg-rr60.6%
[Start]59.6 | \[ \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\] |
|---|---|
add-sqr-sqrt [=>]60.4 | \[ \frac{\left(-b_2\right) - \color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}
\] |
pow2 [=>]60.4 | \[ \frac{\left(-b_2\right) - \color{blue}{{\left(\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}\right)}^{2}}}{a}
\] |
pow1/2 [=>]60.4 | \[ \frac{\left(-b_2\right) - {\left(\sqrt{\color{blue}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.5}}}\right)}^{2}}{a}
\] |
sqrt-pow1 [=>]60.6 | \[ \frac{\left(-b_2\right) - {\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2}}{a}
\] |
metadata-eval [=>]60.6 | \[ \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.25}}\right)}^{2}}{a}
\] |
Applied egg-rr59.1%
[Start]60.6 | \[ \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}{a}
\] |
|---|---|
flip-- [=>]60.6 | \[ \frac{\color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2} \cdot {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}{\left(-b_2\right) + {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}}}{a}
\] |
frac-2neg [=>]60.6 | \[ \frac{\color{blue}{\frac{-\left(\left(-b_2\right) \cdot \left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2} \cdot {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}\right)}{-\left(\left(-b_2\right) + {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}\right)}}}{a}
\] |
Simplified83.0%
[Start]59.1 | \[ \frac{\frac{-\left(b_2 \cdot b_2 - \left(b_2 \cdot b_2 - a \cdot c\right)\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a}
\] |
|---|---|
unpow2 [<=]59.1 | \[ \frac{\frac{-\left(\color{blue}{{b_2}^{2}} - \left(b_2 \cdot b_2 - a \cdot c\right)\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a}
\] |
unpow2 [<=]59.1 | \[ \frac{\frac{-\left({b_2}^{2} - \left(\color{blue}{{b_2}^{2}} - a \cdot c\right)\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a}
\] |
associate--r- [=>]83.0 | \[ \frac{\frac{-\color{blue}{\left(\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c\right)}}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a}
\] |
+-inverses [=>]83.0 | \[ \frac{\frac{-\left(\color{blue}{0} + a \cdot c\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a}
\] |
*-commutative [<=]83.0 | \[ \frac{\frac{-\left(0 + \color{blue}{c \cdot a}\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a}
\] |
distribute-neg-in [=>]83.0 | \[ \frac{\frac{\color{blue}{\left(-0\right) + \left(-c \cdot a\right)}}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a}
\] |
metadata-eval [=>]83.0 | \[ \frac{\frac{\color{blue}{0} + \left(-c \cdot a\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a}
\] |
sub-neg [<=]83.0 | \[ \frac{\frac{\color{blue}{0 - c \cdot a}}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a}
\] |
neg-sub0 [<=]83.0 | \[ \frac{\frac{\color{blue}{-c \cdot a}}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a}
\] |
distribute-rgt-neg-in [=>]83.0 | \[ \frac{\frac{\color{blue}{c \cdot \left(-a\right)}}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a}
\] |
*-commutative [<=]83.0 | \[ \frac{\frac{c \cdot \left(-a\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-\color{blue}{c \cdot a}}\right)}}{a}
\] |
distribute-rgt-neg-in [=>]83.0 | \[ \frac{\frac{c \cdot \left(-a\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{\color{blue}{c \cdot \left(-a\right)}}\right)}}{a}
\] |
if -2.9999999999999999e-81 < b_2 < 4.9999999999999997e-152Initial program 77.4%
Applied egg-rr85.1%
[Start]77.4 | \[ \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\] |
|---|---|
sub-neg [=>]77.4 | \[ \frac{\left(-b_2\right) - \sqrt{\color{blue}{b_2 \cdot b_2 + \left(-a \cdot c\right)}}}{a}
\] |
+-commutative [=>]77.4 | \[ \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(-a \cdot c\right) + b_2 \cdot b_2}}}{a}
\] |
add-sqr-sqrt [=>]77.4 | \[ \frac{\left(-b_2\right) - \sqrt{\color{blue}{\sqrt{-a \cdot c} \cdot \sqrt{-a \cdot c}} + b_2 \cdot b_2}}{a}
\] |
hypot-def [=>]85.1 | \[ \frac{\left(-b_2\right) - \color{blue}{\mathsf{hypot}\left(\sqrt{-a \cdot c}, b_2\right)}}{a}
\] |
*-commutative [=>]85.1 | \[ \frac{\left(-b_2\right) - \mathsf{hypot}\left(\sqrt{-\color{blue}{c \cdot a}}, b_2\right)}{a}
\] |
distribute-rgt-neg-in [=>]85.1 | \[ \frac{\left(-b_2\right) - \mathsf{hypot}\left(\sqrt{\color{blue}{c \cdot \left(-a\right)}}, b_2\right)}{a}
\] |
if 4.9999999999999997e-152 < b_2 < 4.4999999999999999e142Initial program 88.6%
if 4.4999999999999999e142 < b_2 Initial program 38.1%
Applied egg-rr38.0%
[Start]38.1 | \[ \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\] |
|---|---|
add-sqr-sqrt [=>]38.0 | \[ \frac{\left(-b_2\right) - \color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}
\] |
pow2 [=>]38.0 | \[ \frac{\left(-b_2\right) - \color{blue}{{\left(\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}\right)}^{2}}}{a}
\] |
pow1/2 [=>]38.0 | \[ \frac{\left(-b_2\right) - {\left(\sqrt{\color{blue}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.5}}}\right)}^{2}}{a}
\] |
sqrt-pow1 [=>]38.0 | \[ \frac{\left(-b_2\right) - {\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2}}{a}
\] |
metadata-eval [=>]38.0 | \[ \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.25}}\right)}^{2}}{a}
\] |
Applied egg-rr37.4%
[Start]38.0 | \[ \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}{a}
\] |
|---|---|
prod-diff [=>]37.4 | \[ \frac{\left(-b_2\right) - {\left({\color{blue}{\left(\mathsf{fma}\left(b_2, b_2, -c \cdot a\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}}^{0.25}\right)}^{2}}{a}
\] |
*-commutative [<=]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\mathsf{fma}\left(b_2, b_2, -\color{blue}{a \cdot c}\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
fma-neg [<=]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
prod-diff [=>]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\color{blue}{\left(\mathsf{fma}\left(b_2, b_2, -c \cdot a\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
*-commutative [<=]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(\mathsf{fma}\left(b_2, b_2, -\color{blue}{a \cdot c}\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
fma-neg [<=]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
associate-+l+ [=>]37.4 | \[ \frac{\left(-b_2\right) - {\left({\color{blue}{\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(-c, a, c \cdot a\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}}^{0.25}\right)}^{2}}{a}
\] |
*-commutative [<=]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(-c, a, \color{blue}{a \cdot c}\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
fma-udef [=>]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\color{blue}{\left(\left(-c\right) \cdot a + a \cdot c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
distribute-lft-neg-in [<=]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\left(\color{blue}{\left(-c \cdot a\right)} + a \cdot c\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
*-commutative [<=]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\left(\left(-\color{blue}{a \cdot c}\right) + a \cdot c\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
distribute-rgt-neg-in [=>]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\left(\color{blue}{a \cdot \left(-c\right)} + a \cdot c\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
fma-def [=>]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\color{blue}{\mathsf{fma}\left(a, -c, a \cdot c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
*-commutative [<=]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \mathsf{fma}\left(-c, a, \color{blue}{a \cdot c}\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
fma-udef [=>]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \color{blue}{\left(\left(-c\right) \cdot a + a \cdot c\right)}\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
distribute-lft-neg-in [<=]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \left(\color{blue}{\left(-c \cdot a\right)} + a \cdot c\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
*-commutative [<=]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \left(\left(-\color{blue}{a \cdot c}\right) + a \cdot c\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
distribute-rgt-neg-in [=>]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \left(\color{blue}{a \cdot \left(-c\right)} + a \cdot c\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
fma-def [=>]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \color{blue}{\mathsf{fma}\left(a, -c, a \cdot c\right)}\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
Simplified37.4%
[Start]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \mathsf{fma}\left(a, -c, a \cdot c\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
|---|---|
*-commutative [=>]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - \color{blue}{c \cdot a}\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \mathsf{fma}\left(a, -c, a \cdot c\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
count-2 [=>]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - c \cdot a\right) + \color{blue}{2 \cdot \mathsf{fma}\left(a, -c, a \cdot c\right)}\right)}^{0.25}\right)}^{2}}{a}
\] |
*-commutative [=>]37.4 | \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - c \cdot a\right) + 2 \cdot \mathsf{fma}\left(a, -c, \color{blue}{c \cdot a}\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
Taylor expanded in a around 0 90.5%
Final simplification89.8%
| Alternative 1 | |
|---|---|
| Accuracy | 86.4% |
| Cost | 13968 |
| Alternative 2 | |
|---|---|
| Accuracy | 86.9% |
| Cost | 13704 |
| Alternative 3 | |
|---|---|
| Accuracy | 86.4% |
| Cost | 7432 |
| Alternative 4 | |
|---|---|
| Accuracy | 81.2% |
| Cost | 7240 |
| Alternative 5 | |
|---|---|
| Accuracy | 68.7% |
| Cost | 836 |
| Alternative 6 | |
|---|---|
| Accuracy | 68.7% |
| Cost | 836 |
| Alternative 7 | |
|---|---|
| Accuracy | 43.9% |
| Cost | 452 |
| Alternative 8 | |
|---|---|
| Accuracy | 68.1% |
| Cost | 452 |
| Alternative 9 | |
|---|---|
| Accuracy | 68.5% |
| Cost | 452 |
| Alternative 10 | |
|---|---|
| Accuracy | 23.4% |
| Cost | 388 |
| Alternative 11 | |
|---|---|
| Accuracy | 10.9% |
| Cost | 192 |
herbie shell --seed 2023161
(FPCore (a b_2 c)
:name "quad2m (problem 3.2.1, negative)"
:precision binary64
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))