Average Error: 36.4 → 7.4
Time: 1.6m
Precision: 64
Ground Truth: 128
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -2.430754546208037 \cdot 10^{-37}:\\ \;\;\;\;\frac{c}{\frac{c \cdot \frac{1}{2}}{\frac{b/2}{a}} - \left(b/2 - \left(-b/2\right)\right)}\\ \mathbf{if}\;b/2 \le 3.474250069101817 \cdot 10^{+81}:\\ \;\;\;\;\left(\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}\right) \cdot \frac{1}{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 3 regimes.
  2. if b/2 < -2.430754546208037e-37

    1. Initial program 58.1

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

      \[\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 33.0

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

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

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

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

    if -2.430754546208037e-37 < b/2 < 3.474250069101817e+81

    1. Initial program 14.1

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

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

    if 3.474250069101817e+81 < b/2

    1. Initial program 43.4

      \[\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 3 regimes into one program.
  4. Removed slow pow expressions

Runtime

Total time: 1.6m Debug log

Please include this information when filing a bug report:

herbie --seed '#(1585070354 847197416 4271129918 774737073 2582064250 2130020083)'
(FPCore (a b/2 c)
  :name "NMSE problem 3.2.1, negative"
  (/ (- (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))