Average Error: 34.8 → 7.3
Time: 15.4s
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 -2.264928659976216 \cdot 10^{+29}:\\ \;\;\;\;\frac{c}{\frac{c}{b/2} \cdot \left(\frac{1}{2} \cdot a\right) - \left(b/2 - \left(-b/2\right)\right)}\\ \mathbf{if}\;b/2 \le -5.874839546400093 \cdot 10^{-149}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}{a}\\ \mathbf{if}\;b/2 \le 1.1073706101041596 \cdot 10^{+76}:\\ \;\;\;\;\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}\]

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 < -2.264928659976216e+29

    1. Initial program 58.0

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

      \[\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}\]
    4. Applied simplify 31.4

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied div-inv 31.4

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

      \[\leadsto \frac{c \cdot a}{\left(-b/2\right) + \left(\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - b/2\right)} \cdot \frac{1}{a}\]
    8. Taylor expanded around -inf 15.0

      \[\leadsto \frac{c \cdot a}{\left(-b/2\right) + \color{blue}{\left(\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - b/2\right)}} \cdot \frac{1}{a}\]
    9. Applied simplify 2.4

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

    if -2.264928659976216e+29 < b/2 < -5.874839546400093e-149

    1. Initial program 34.9

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

      \[\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}\]
    4. Applied simplify 17.0

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

    if -5.874839546400093e-149 < b/2 < 1.1073706101041596e+76

    1. Initial program 11.6

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

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

    if 1.1073706101041596e+76 < b/2

    1. Initial program 41.9

      \[\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: 15.4s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1064555532 179913862 452496668 2441903500 287849034 462453547)'
(FPCore (a b/2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))