Average Error: 33.9 → 5.4
Time: 35.9s
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 -5.275923490878762 \cdot 10^{+150}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le -2.8117296895841062 \cdot 10^{-251}:\\ \;\;\;\;\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\\ \mathbf{if}\;b/2 \le 6.193250476192916 \cdot 10^{+56}:\\ \;\;\;\;\frac{1}{\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - c \cdot a}}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{a \cdot \frac{1}{2}}{\frac{b/2}{c}} + \left(\left(-b/2\right) - b/2\right)}\\ \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 < -5.275923490878762e+150

    1. Initial program 59.0

      \[\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}}\]

    if -5.275923490878762e+150 < b/2 < -2.8117296895841062e-251

    1. Initial program 7.4

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

    if -2.8117296895841062e-251 < b/2 < 6.193250476192916e+56

    1. Initial program 26.6

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

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

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

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

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

    if 6.193250476192916e+56 < b/2

    1. Initial program 58.4

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

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

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

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

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

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

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

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

Runtime

Total time: 35.9s Debug log

Please report a bug with the following info:

herbie --seed '#(1998531 2199324972 2165374100 2309839377 1240443112 1161880501)'
(FPCore (a b/2 c)
  :name "NMSE problem 3.2.1, positive"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))