Average Error: 39.8 → 4.2
Time: 38.0s
Precision: 64
Internal precision: 2432
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;b/2 \le -1.978699881745306 \cdot 10^{-162}:\\
\;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\
\mathbf{if}\;b/2 \le 2.4225703873767033 \cdot 10^{+115}:\\
\;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b/2}{a}\\
\end{array}\]
Derivation
- Split input into 3 regimes.
-
if b/2 < -1.978699881745306e-162
Initial program 59.2
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
Applied taylor 16.2
\[\leadsto \frac{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}{a}\]
Taylor expanded around -inf 16.2
\[\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.978699881745306e-162 < b/2 < 2.4225703873767033e+115
Initial program 10.9
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
- Using strategy
rm
Applied clear-num 11.1
\[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}}\]
if 2.4225703873767033e+115 < b/2
Initial program 50.2
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/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 3 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie shell --seed '#(1068028399 4028058041 2917032441 2563479541 765645300 1132738916)'
(FPCore (a b/2 c)
:name "quad2m (problem 3.2.1, negative)"
(/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))