Average Error: 35.9 → 7.4
Time: 57.3s
Precision: 64
Internal precision: 3200
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;b/2 \le -1.9038547349802057 \cdot 10^{-44}:\\
\;\;\;\;\frac{c}{\left(\frac{1}{2} \cdot c\right) \cdot \frac{a}{b/2} - \left(b/2 - \left(-b/2\right)\right)}\\
\mathbf{if}\;b/2 \le 4.585114762073355 \cdot 10^{+93}:\\
\;\;\;\;\left(\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b/2}{a}\\
\end{array}\]
Derivation
- Split input into 3 regimes.
-
if b/2 < -1.9038547349802057e-44
Initial program 58.3
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
- Using strategy
rm
Applied flip-- 58.4
\[\leadsto \frac{\color{blue}{\frac{\left(-b/2\right) \cdot \left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c} \cdot \sqrt{b/2 \cdot b/2 - a \cdot c}}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}}{a}\]
Applied simplify 33.6
\[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}{a}\]
Taylor expanded around -inf 15.5
\[\leadsto \frac{\frac{c \cdot a}{\left(-b/2\right) + \color{blue}{\left(\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - b/2\right)}}}{a}\]
Applied simplify 3.1
\[\leadsto \color{blue}{\frac{c}{\left(\frac{1}{2} \cdot c\right) \cdot \frac{a}{b/2} - \left(b/2 - \left(-b/2\right)\right)}}\]
if -1.9038547349802057e-44 < b/2 < 4.585114762073355e+93
Initial program 13.6
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
- Using strategy
rm
Applied div-inv 13.7
\[\leadsto \color{blue}{\left(\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
if 4.585114762073355e+93 < b/2
Initial program 44.8
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
Taylor expanded around inf 0
\[\leadsto \color{blue}{-2 \cdot \frac{b/2}{a}}\]
- Recombined 3 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie shell --seed '#(2329929097 3210370195 3111198779 2406363002 3511342718 2136436390)'
(FPCore (a b/2 c)
:name "quad2m (problem 3.2.1, negative)"
(/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))