Average Error: 34.9 → 7.0
Time: 1.2m
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 -7.599846762415676 \cdot 10^{+61}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b/2 \le -3.836119197736596 \cdot 10^{-106}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}{a}\\ \mathbf{if}\;b/2 \le 4.966247580688122 \cdot 10^{+78}:\\ \;\;\;\;\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b/2} + \frac{\left(-b/2\right) - 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 < -7.599846762415676e+61

    1. Initial program 58.0

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

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

      \[\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 -7.599846762415676e+61 < b/2 < -3.836119197736596e-106

    1. Initial program 40.5

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

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

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

    if -3.836119197736596e-106 < b/2 < 4.966247580688122e+78

    1. Initial program 12.0

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

    if 4.966247580688122e+78 < b/2

    1. Initial program 43.1

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b/2} + \frac{\left(-b/2\right) - b/2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Removed slow pow expressions

Runtime

Total time: 1.2m Debug log

Please include this information when filing a bug report:

herbie --seed '#(3760836333 3113101096 1594397572 961627152 2528714756 2949901030)'
(FPCore (a b/2 c)
  :name "NMSE problem 3.2.1, negative"
  (/ (- (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))