Average Error: 38.5 → 4.8
Time: 28.3s
Precision: 64
Internal precision: 128
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -2.2905235532000777 \cdot 10^{-122}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b/2 \le 1.0905893076356243 \cdot 10^{+100}:\\ \;\;\;\;\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 3 regimes.
  2. if b/2 < -2.2905235532000777e-122

    1. Initial program 58.9

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

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

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

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

      \[\leadsto \color{blue}{\frac{c}{b/2} \cdot \frac{-1}{2}}\]

    if -2.2905235532000777e-122 < b/2 < 1.0905893076356243e+100

    1. Initial program 12.2

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

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

    if 1.0905893076356243e+100 < b/2

    1. Initial program 44.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 3 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 28.3s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(2816785298 1417017899 863877895 3357173055 1361983740 4265040848)'
(FPCore (a b/2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))