Average Error: 33.3 → 10.0
Time: 1.7m
Precision: 64
Internal Precision: 3200
\[\frac{\left(-b2\right) + \sqrt{b2 \cdot b2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b2 \le -1.762802445767182 \cdot 10^{+83}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b2} - 2 \cdot \frac{b2}{a}\\ \mathbf{if}\;b2 \le 2.0436989411471357 \cdot 10^{-114}:\\ \;\;\;\;\frac{\left(-b2\right) + \sqrt{b2 \cdot b2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\left(-b2\right) - b2\right) + \left(\frac{1}{2} \cdot c\right) \cdot \frac{a}{b2}}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b2

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if b2 < -1.762802445767182e+83

    1. Initial program 41.5

      \[\frac{\left(-b2\right) + \sqrt{b2 \cdot b2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied div-inv41.5

      \[\leadsto \color{blue}{\left(\left(-b2\right) + \sqrt{b2 \cdot b2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Taylor expanded around -inf 3.9

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b2} - 2 \cdot \frac{b2}{a}}\]

    if -1.762802445767182e+83 < b2 < 2.0436989411471357e-114

    1. Initial program 11.5

      \[\frac{\left(-b2\right) + \sqrt{b2 \cdot b2 - a \cdot c}}{a}\]

    if 2.0436989411471357e-114 < b2

    1. Initial program 51.2

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

      \[\leadsto \frac{\color{blue}{\frac{\left(-b2\right) \cdot \left(-b2\right) - \sqrt{b2 \cdot b2 - a \cdot c} \cdot \sqrt{b2 \cdot b2 - a \cdot c}}{\left(-b2\right) - \sqrt{b2 \cdot b2 - a \cdot c}}}}{a}\]
    4. Applied simplify24.5

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b2\right) - \sqrt{b2 \cdot b2 - a \cdot c}}}{a}\]
    5. Taylor expanded around inf 22.2

      \[\leadsto \frac{\frac{c \cdot a}{\left(-b2\right) - \color{blue}{\left(b2 - \frac{1}{2} \cdot \frac{c \cdot a}{b2}\right)}}}{a}\]
    6. Applied simplify10.9

      \[\leadsto \color{blue}{\frac{c}{\left(\left(-b2\right) - b2\right) + \left(\frac{1}{2} \cdot c\right) \cdot \frac{a}{b2}}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 1.7m)Debug log

herbie shell --seed '#(1743936871 1855164119 3668777427 1254258049 132811564 1366975197)' 
(FPCore (a b2 c)
  :name "NMSE problem 3.2.1, positive"
  :pre (and (>= (* b2 b2) (* a c)) (!= a 0))
  (/ (+ (- b2) (sqrt (- (* b2 b2) (* a c)))) a))