Average Error: 36.1 → 6.1
Time: 29.5s
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 -9.117517880804678 \cdot 10^{+140}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b/2 \le 3.131324707375834 \cdot 10^{-52}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{b/2 \cdot b/2 - c \cdot a} + \left(-b/2\right)}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{b/2}{\frac{1}{2}}} - b/2 \cdot \frac{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 < -9.117517880804678e+140

    1. Initial program 61.4

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

      \[\leadsto \frac{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}{a}\]
    3. Taylor expanded around -inf 14.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 -9.117517880804678e+140 < b/2 < 3.131324707375834e-52

    1. Initial program 25.6

      \[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-- 29.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.2

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

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

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

    if 3.131324707375834e-52 < b/2

    1. Initial program 37.4

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

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

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

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

Runtime

Total time: 29.5s Debug log

Please report a bug with the following info:

herbie --seed '#(2119936345 846178467 2549547724 1485677938 2992606190 2182940698)'
(FPCore (a b/2 c)
  :name "NMSE problem 3.2.1, negative"
  (/ (- (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))