Average Error: 34.2 → 5.4
Time: 16.0s
Precision: 64
Internal precision: 2944
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;b/2 \le -1.718982199476945 \cdot 10^{+89}:\\
\;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\
\mathbf{if}\;b/2 \le -2.321564696919607 \cdot 10^{-245}:\\
\;\;\;\;{\left(\sqrt[3]{\frac{c}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}\right)}^3\\
\mathbf{if}\;b/2 \le 9.141549925217606 \cdot 10^{+73}:\\
\;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b/2}{a}\\
\end{array}\]
Derivation
- Split input into 4 regimes.
-
if b/2 < -1.718982199476945e+89
Initial program 59.3
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
Applied taylor 15.8
\[\leadsto \frac{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}{a}\]
Taylor expanded around -inf 15.8
\[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}}{a}\]
Applied simplify 0.0
\[\leadsto \color{blue}{\frac{c}{b/2} \cdot \frac{-1}{2}}\]
if -1.718982199476945e+89 < b/2 < -2.321564696919607e-245
Initial program 33.6
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
- Using strategy
rm
Applied flip-- 33.7
\[\leadsto \frac{\color{blue}{\frac{{\left(-b/2\right)}^2 - {\left(\sqrt{{b/2}^2 - a \cdot c}\right)}^2}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}}{a}\]
Applied simplify 17.1
\[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}{a}\]
- Using strategy
rm
Applied add-cube-cbrt 17.8
\[\leadsto \color{blue}{{\left(\sqrt[3]{\frac{\frac{c \cdot a}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}{a}}\right)}^3}\]
Applied simplify 9.3
\[\leadsto {\color{blue}{\left(\sqrt[3]{\frac{c}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}\right)}}^3\]
if -2.321564696919607e-245 < b/2 < 9.141549925217606e+73
Initial program 9.7
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
- Using strategy
rm
Applied clear-num 9.8
\[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}}\]
if 9.141549925217606e+73 < b/2
Initial program 42.4
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
Applied taylor 0
\[\leadsto -2 \cdot \frac{b/2}{a}\]
Taylor expanded around inf 0
\[\leadsto \color{blue}{-2 \cdot \frac{b/2}{a}}\]
- Recombined 4 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie shell --seed '#(1064524629 4159152179 2999149171 575749698 4006532819 692958815)'
(FPCore (a b/2 c)
:name "quad2m (problem 3.2.1, negative)"
(/ (- (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))