Average Error: 34.5 → 7.4
Time: 12.0s
Precision: 64
Internal precision: 3200
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -3.766497225051822 \cdot 10^{+62}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b/2 \le -2.8254884407435903 \cdot 10^{-279}:\\ \;\;\;\;\frac{1}{\frac{a}{\frac{c \cdot a}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}}\\ \mathbf{if}\;b/2 \le 1.5677719585707962 \cdot 10^{+117}:\\ \;\;\;\;\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b/2

Bits error versus c

Derivation

  1. Split input into 4 regimes.
  2. if b/2 < -3.766497225051822e+62

    1. Initial program 58.0

      \[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Applied taylor 15.6

      \[\leadsto \frac{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}{a}\]
    3. Taylor expanded around -inf 15.6

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}}{a}\]
    4. Applied simplify 0.0

      \[\leadsto \color{blue}{\frac{c}{b/2} \cdot \frac{-1}{2}}\]

    if -3.766497225051822e+62 < b/2 < -2.8254884407435903e-279

    1. Initial program 32.1

      \[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num 32.1

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied flip-- 32.2

      \[\leadsto \frac{1}{\frac{a}{\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}}}}}\]
    6. Applied simplify 17.7

      \[\leadsto \frac{1}{\frac{a}{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}}\]

    if -2.8254884407435903e-279 < b/2 < 1.5677719585707962e+117

    1. Initial program 9.0

      \[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]

    if 1.5677719585707962e+117 < b/2

    1. Initial program 49.3

      \[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Applied taylor 0

      \[\leadsto -2 \cdot \frac{b/2}{a}\]
    3. Taylor expanded around inf 0

      \[\leadsto \color{blue}{-2 \cdot \frac{b/2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 12.0s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1067615470 1817955187 3564058462 2385304812 1026693554 2746013648)'
(FPCore (a b/2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))