Average Error: 33.6 → 10.0
Time: 2.5m
Precision: 64
Internal Precision: 3200
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -6.974405503731355 \cdot 10^{-42}:\\ \;\;\;\;\frac{c}{\frac{c \cdot \frac{1}{2}}{\frac{b/2}{a}} - \left(b/2 + b/2\right)}\\ \mathbf{if}\;b/2 \le 6.814766808373949 \cdot 10^{+121}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/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 < -6.974405503731355e-42

    1. Initial program 54.2

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied flip--54.3

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{\frac{\left(-b/2\right) \cdot \left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c} \cdot \sqrt{b/2 \cdot b/2 - a \cdot c}}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}}}\]
    6. Applied associate-/r/54.3

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

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{c \cdot a}} \cdot \left(\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}\right)}\]
    8. Taylor expanded around -inf 13.2

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

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

    if -6.974405503731355e-42 < b/2 < 6.814766808373949e+121

    1. Initial program 14.0

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

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

    if 6.814766808373949e+121 < b/2

    1. Initial program 49.8

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Taylor expanded around inf 2.7

      \[\leadsto \color{blue}{-2 \cdot \frac{b/2}{a}}\]
  3. Recombined 3 regimes into one program.
  4. Applied simplify10.0

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b/2 \le -6.974405503731355 \cdot 10^{-42}:\\ \;\;\;\;\frac{c}{\frac{c \cdot \frac{1}{2}}{\frac{b/2}{a}} - \left(b/2 + b/2\right)}\\ \mathbf{if}\;b/2 \le 6.814766808373949 \cdot 10^{+121}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \end{array}}\]

Runtime

Time bar (total: 2.5m)Debug logProfile

herbie shell --seed '#(1070609872 3456127585 2380521889 2328837196 1765472538 734540918)' +o rules:numerics
(FPCore (a b/2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))