Average Error: 34.4 → 5.9
Time: 12.9s
Precision: 64
Internal precision: 2688
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;b/2 \le -9.309963021915681 \cdot 10^{+129}:\\
\;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\
\mathbf{if}\;b/2 \le 5.3169981736823014 \cdot 10^{-303}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{{b/2}^2 - c \cdot a} + \left(-b/2\right)}{c}}\\
\mathbf{if}\;b/2 \le 5.782486744451723 \cdot 10^{+116}:\\
\;\;\;\;\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b/2}{a}\\
\end{array}\]
Derivation
- Split input into 4 regimes.
-
if b/2 < -9.309963021915681e+129
Initial program 61.3
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
Applied taylor 14.4
\[\leadsto \frac{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}{a}\]
Taylor expanded around -inf 14.4
\[\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 -9.309963021915681e+129 < b/2 < 5.3169981736823014e-303
Initial program 34.6
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
- Using strategy
rm
Applied flip-- 34.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 16.6
\[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}{a}\]
- Using strategy
rm
Applied clear-num 16.8
\[\leadsto \color{blue}{\frac{1}{\frac{a}{\frac{c \cdot a}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}}}\]
Applied simplify 9.4
\[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{{b/2}^2 - c \cdot a} + \left(-b/2\right)}{c}}}\]
if 5.3169981736823014e-303 < b/2 < 5.782486744451723e+116
Initial program 8.7
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
if 5.782486744451723e+116 < b/2
Initial program 51.2
\[\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 '#(1065033997 2389885643 4100569014 2620012693 26800780 3144211646)'
(FPCore (a b/2 c)
:name "quad2m (problem 3.2.1, negative)"
(/ (- (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))