| Alternative 1 | |
|---|---|
| Accuracy | 84.9% |
| Cost | 7624 |

(FPCore (a b_2 c) :precision binary64 (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -4.2e-22)
(/ (* -0.5 c) b_2)
(if (<= b_2 3e-191)
(/ (- (- b_2) (hypot (sqrt (- (* c a))) b_2)) a)
(if (<= b_2 5.8e+56)
(- (/ (- b_2) a) (/ (pow (- (* b_2 b_2) (* c a)) 0.5) a))
(/ (* b_2 -2.0) a)))))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 tmp;
if (b_2 <= -4.2e-22) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 3e-191) {
tmp = (-b_2 - hypot(sqrt(-(c * a)), b_2)) / a;
} else if (b_2 <= 5.8e+56) {
tmp = (-b_2 / a) - (pow(((b_2 * b_2) - (c * a)), 0.5) / a);
} else {
tmp = (b_2 * -2.0) / a;
}
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 tmp;
if (b_2 <= -4.2e-22) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 3e-191) {
tmp = (-b_2 - Math.hypot(Math.sqrt(-(c * a)), b_2)) / a;
} else if (b_2 <= 5.8e+56) {
tmp = (-b_2 / a) - (Math.pow(((b_2 * b_2) - (c * a)), 0.5) / a);
} else {
tmp = (b_2 * -2.0) / a;
}
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): tmp = 0 if b_2 <= -4.2e-22: tmp = (-0.5 * c) / b_2 elif b_2 <= 3e-191: tmp = (-b_2 - math.hypot(math.sqrt(-(c * a)), b_2)) / a elif b_2 <= 5.8e+56: tmp = (-b_2 / a) - (math.pow(((b_2 * b_2) - (c * a)), 0.5) / a) else: tmp = (b_2 * -2.0) / a 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) tmp = 0.0 if (b_2 <= -4.2e-22) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= 3e-191) tmp = Float64(Float64(Float64(-b_2) - hypot(sqrt(Float64(-Float64(c * a))), b_2)) / a); elseif (b_2 <= 5.8e+56) tmp = Float64(Float64(Float64(-b_2) / a) - Float64((Float64(Float64(b_2 * b_2) - Float64(c * a)) ^ 0.5) / a)); else tmp = Float64(Float64(b_2 * -2.0) / a); 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) tmp = 0.0; if (b_2 <= -4.2e-22) tmp = (-0.5 * c) / b_2; elseif (b_2 <= 3e-191) tmp = (-b_2 - hypot(sqrt(-(c * a)), b_2)) / a; elseif (b_2 <= 5.8e+56) tmp = (-b_2 / a) - ((((b_2 * b_2) - (c * a)) ^ 0.5) / a); else tmp = (b_2 * -2.0) / a; 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_] := If[LessEqual[b$95$2, -4.2e-22], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 3e-191], N[(N[((-b$95$2) - N[Sqrt[N[Sqrt[(-N[(c * a), $MachinePrecision])], $MachinePrecision] ^ 2 + b$95$2 ^ 2], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, 5.8e+56], N[(N[((-b$95$2) / a), $MachinePrecision] - N[(N[Power[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(c * a), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision]]]]
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
\mathbf{if}\;b_2 \leq -4.2 \cdot 10^{-22}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{elif}\;b_2 \leq 3 \cdot 10^{-191}:\\
\;\;\;\;\frac{\left(-b_2\right) - \mathsf{hypot}\left(\sqrt{-c \cdot a}, b_2\right)}{a}\\
\mathbf{elif}\;b_2 \leq 5.8 \cdot 10^{+56}:\\
\;\;\;\;\frac{-b_2}{a} - \frac{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{0.5}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\
\end{array}
Results
if b_2 < -4.20000000000000016e-22Initial program 18.6%
Taylor expanded in b_2 around -inf 87.2%
Simplified87.2%
[Start]87.2 | \[ -0.5 \cdot \frac{c}{b_2}
\] |
|---|---|
associate-*r/ [=>]87.2 | \[ \color{blue}{\frac{-0.5 \cdot c}{b_2}}
\] |
if -4.20000000000000016e-22 < b_2 < 3.0000000000000001e-191Initial program 75.0%
Applied egg-rr81.6%
[Start]75.0 | \[ \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\] |
|---|---|
sub-neg [=>]75.0 | \[ \frac{\left(-b_2\right) - \sqrt{\color{blue}{b_2 \cdot b_2 + \left(-a \cdot c\right)}}}{a}
\] |
+-commutative [=>]75.0 | \[ \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(-a \cdot c\right) + b_2 \cdot b_2}}}{a}
\] |
add-sqr-sqrt [=>]75.0 | \[ \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 [=>]81.6 | \[ \frac{\left(-b_2\right) - \color{blue}{\mathsf{hypot}\left(\sqrt{-a \cdot c}, b_2\right)}}{a}
\] |
*-commutative [=>]81.6 | \[ \frac{\left(-b_2\right) - \mathsf{hypot}\left(\sqrt{-\color{blue}{c \cdot a}}, b_2\right)}{a}
\] |
distribute-rgt-neg-in [=>]81.6 | \[ \frac{\left(-b_2\right) - \mathsf{hypot}\left(\sqrt{\color{blue}{c \cdot \left(-a\right)}}, b_2\right)}{a}
\] |
if 3.0000000000000001e-191 < b_2 < 5.80000000000000014e56Initial program 90.3%
Applied egg-rr89.9%
[Start]90.3 | \[ \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\] |
|---|---|
add-sqr-sqrt [=>]89.9 | \[ \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 [=>]89.9 | \[ \frac{\left(-b_2\right) - \color{blue}{{\left(\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}\right)}^{2}}}{a}
\] |
pow1/2 [=>]89.9 | \[ \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 [=>]89.9 | \[ \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 [=>]89.9 | \[ \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-rr84.6%
[Start]89.9 | \[ \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}{a}
\] |
|---|---|
add-exp-log [=>]84.6 | \[ \frac{\left(-b_2\right) - {\color{blue}{\left(e^{\log \left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}\right)}}^{2}}{a}
\] |
log-pow [=>]84.6 | \[ \frac{\left(-b_2\right) - {\left(e^{\color{blue}{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}}\right)}^{2}}{a}
\] |
Applied egg-rr90.0%
[Start]84.6 | \[ \frac{\left(-b_2\right) - {\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}
\] |
|---|---|
div-sub [=>]84.5 | \[ \color{blue}{\frac{-b_2}{a} - \frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}}
\] |
neg-mul-1 [=>]84.5 | \[ \frac{\color{blue}{-1 \cdot b_2}}{a} - \frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}
\] |
*-un-lft-identity [=>]84.5 | \[ \frac{-1 \cdot b_2}{\color{blue}{1 \cdot a}} - \frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}
\] |
times-frac [=>]84.5 | \[ \color{blue}{\frac{-1}{1} \cdot \frac{b_2}{a}} - \frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}
\] |
metadata-eval [=>]84.5 | \[ \color{blue}{-1} \cdot \frac{b_2}{a} - \frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}
\] |
add-sqr-sqrt [=>]84.6 | \[ -1 \cdot \frac{\color{blue}{\sqrt{b_2} \cdot \sqrt{b_2}}}{a} - \frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}
\] |
sqrt-prod [<=]84.5 | \[ -1 \cdot \frac{\color{blue}{\sqrt{b_2 \cdot b_2}}}{a} - \frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}
\] |
sqr-neg [<=]84.5 | \[ -1 \cdot \frac{\sqrt{\color{blue}{\left(-b_2\right) \cdot \left(-b_2\right)}}}{a} - \frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}
\] |
sqrt-unprod [<=]0.0 | \[ -1 \cdot \frac{\color{blue}{\sqrt{-b_2} \cdot \sqrt{-b_2}}}{a} - \frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}
\] |
add-sqr-sqrt [<=]54.5 | \[ -1 \cdot \frac{\color{blue}{-b_2}}{a} - \frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}
\] |
fma-neg [=>]54.5 | \[ \color{blue}{\mathsf{fma}\left(-1, \frac{-b_2}{a}, -\frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}\right)}
\] |
add-sqr-sqrt [=>]0.0 | \[ \mathsf{fma}\left(-1, \frac{\color{blue}{\sqrt{-b_2} \cdot \sqrt{-b_2}}}{a}, -\frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}\right)
\] |
sqrt-unprod [=>]84.5 | \[ \mathsf{fma}\left(-1, \frac{\color{blue}{\sqrt{\left(-b_2\right) \cdot \left(-b_2\right)}}}{a}, -\frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}\right)
\] |
sqr-neg [=>]84.5 | \[ \mathsf{fma}\left(-1, \frac{\sqrt{\color{blue}{b_2 \cdot b_2}}}{a}, -\frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}\right)
\] |
sqrt-prod [=>]84.6 | \[ \mathsf{fma}\left(-1, \frac{\color{blue}{\sqrt{b_2} \cdot \sqrt{b_2}}}{a}, -\frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}\right)
\] |
add-sqr-sqrt [<=]84.5 | \[ \mathsf{fma}\left(-1, \frac{\color{blue}{b_2}}{a}, -\frac{{\left(e^{0.25 \cdot \log \left(b_2 \cdot b_2 - a \cdot c\right)}\right)}^{2}}{a}\right)
\] |
Simplified90.4%
[Start]90.0 | \[ \mathsf{fma}\left(-1, \frac{b_2}{a}, -\frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, a \cdot \left(-c\right)\right)\right)}^{0.25}\right)}^{2}}{a}\right)
\] |
|---|---|
fma-udef [=>]90.0 | \[ \color{blue}{-1 \cdot \frac{b_2}{a} + \left(-\frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, a \cdot \left(-c\right)\right)\right)}^{0.25}\right)}^{2}}{a}\right)}
\] |
unsub-neg [=>]90.0 | \[ \color{blue}{-1 \cdot \frac{b_2}{a} - \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, a \cdot \left(-c\right)\right)\right)}^{0.25}\right)}^{2}}{a}}
\] |
mul-1-neg [=>]90.0 | \[ \color{blue}{\left(-\frac{b_2}{a}\right)} - \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, a \cdot \left(-c\right)\right)\right)}^{0.25}\right)}^{2}}{a}
\] |
unpow2 [=>]90.0 | \[ \left(-\frac{b_2}{a}\right) - \frac{\color{blue}{{\left(\mathsf{fma}\left(b_2, b_2, a \cdot \left(-c\right)\right)\right)}^{0.25} \cdot {\left(\mathsf{fma}\left(b_2, b_2, a \cdot \left(-c\right)\right)\right)}^{0.25}}}{a}
\] |
pow-sqr [=>]90.4 | \[ \left(-\frac{b_2}{a}\right) - \frac{\color{blue}{{\left(\mathsf{fma}\left(b_2, b_2, a \cdot \left(-c\right)\right)\right)}^{\left(2 \cdot 0.25\right)}}}{a}
\] |
fma-udef [=>]90.4 | \[ \left(-\frac{b_2}{a}\right) - \frac{{\color{blue}{\left(b_2 \cdot b_2 + a \cdot \left(-c\right)\right)}}^{\left(2 \cdot 0.25\right)}}{a}
\] |
unpow2 [<=]90.4 | \[ \left(-\frac{b_2}{a}\right) - \frac{{\left(\color{blue}{{b_2}^{2}} + a \cdot \left(-c\right)\right)}^{\left(2 \cdot 0.25\right)}}{a}
\] |
distribute-rgt-neg-out [=>]90.4 | \[ \left(-\frac{b_2}{a}\right) - \frac{{\left({b_2}^{2} + \color{blue}{\left(-a \cdot c\right)}\right)}^{\left(2 \cdot 0.25\right)}}{a}
\] |
*-commutative [<=]90.4 | \[ \left(-\frac{b_2}{a}\right) - \frac{{\left({b_2}^{2} + \left(-\color{blue}{c \cdot a}\right)\right)}^{\left(2 \cdot 0.25\right)}}{a}
\] |
unsub-neg [=>]90.4 | \[ \left(-\frac{b_2}{a}\right) - \frac{{\color{blue}{\left({b_2}^{2} - c \cdot a\right)}}^{\left(2 \cdot 0.25\right)}}{a}
\] |
unpow2 [=>]90.4 | \[ \left(-\frac{b_2}{a}\right) - \frac{{\left(\color{blue}{b_2 \cdot b_2} - c \cdot a\right)}^{\left(2 \cdot 0.25\right)}}{a}
\] |
metadata-eval [=>]90.4 | \[ \left(-\frac{b_2}{a}\right) - \frac{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\color{blue}{0.5}}}{a}
\] |
if 5.80000000000000014e56 < b_2 Initial program 65.1%
Taylor expanded in b_2 around inf 98.4%
Simplified98.4%
[Start]98.4 | \[ \frac{-2 \cdot b_2}{a}
\] |
|---|---|
*-commutative [=>]98.4 | \[ \frac{\color{blue}{b_2 \cdot -2}}{a}
\] |
Final simplification88.9%
| Alternative 1 | |
|---|---|
| Accuracy | 84.9% |
| Cost | 7624 |
| Alternative 2 | |
|---|---|
| Accuracy | 84.9% |
| Cost | 7432 |
| Alternative 3 | |
|---|---|
| Accuracy | 80.3% |
| Cost | 7368 |
| Alternative 4 | |
|---|---|
| Accuracy | 80.3% |
| Cost | 7240 |
| Alternative 5 | |
|---|---|
| Accuracy | 80.1% |
| Cost | 7176 |
| Alternative 6 | |
|---|---|
| Accuracy | 67.7% |
| Cost | 836 |
| Alternative 7 | |
|---|---|
| Accuracy | 44.1% |
| Cost | 452 |
| Alternative 8 | |
|---|---|
| Accuracy | 44.1% |
| Cost | 452 |
| Alternative 9 | |
|---|---|
| Accuracy | 67.4% |
| Cost | 452 |
| Alternative 10 | |
|---|---|
| Accuracy | 67.5% |
| Cost | 452 |
| Alternative 11 | |
|---|---|
| Accuracy | 23.9% |
| Cost | 388 |
| Alternative 12 | |
|---|---|
| Accuracy | 11.1% |
| Cost | 192 |
herbie shell --seed 2023159
(FPCore (a b_2 c)
:name "quad2m (problem 3.2.1, negative)"
:precision binary64
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))