Average Error: 34.1 → 6.9
Time: 21.6s
Precision: 64
Internal Precision: 3456
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -7.728783917565007 \cdot 10^{+67}:\\ \;\;\;\;\frac{c}{\left(\frac{1}{2} \cdot c\right) \cdot \frac{a}{b/2} - \left(b/2 - \left(-b/2\right)\right)}\\ \mathbf{if}\;b/2 \le 5.386251553676296 \cdot 10^{-293}:\\ \;\;\;\;\frac{c}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}\\ \mathbf{if}\;b/2 \le 1.7056098619160107 \cdot 10^{+47}:\\ \;\;\;\;\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{b/2}{a}\right) - \left(\frac{b/2}{a} - \frac{c}{\frac{b/2}{\frac{1}{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 < -7.728783917565007e+67

    1. Initial program 58.0

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

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

      \[\leadsto \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}}} \cdot \frac{1}{a}\]
    6. Applied associate-*l/58.1

      \[\leadsto \color{blue}{\frac{\left(\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}\right) \cdot \frac{1}{a}}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}\]
    7. Applied simplify27.5

      \[\leadsto \frac{\color{blue}{c}}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}\]
    8. Using strategy rm
    9. Applied add-exp-log28.7

      \[\leadsto \frac{c}{\left(-b/2\right) + \color{blue}{e^{\log \left(\sqrt{b/2 \cdot b/2 - a \cdot c}\right)}}}\]
    10. Taylor expanded around -inf 9.9

      \[\leadsto \frac{c}{\left(-b/2\right) + e^{\log \color{blue}{\left(\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - b/2\right)}}}\]
    11. Applied simplify3.5

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

    if -7.728783917565007e+67 < b/2 < 5.386251553676296e-293

    1. Initial program 30.1

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

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

      \[\leadsto \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}}} \cdot \frac{1}{a}\]
    6. Applied associate-*l/30.3

      \[\leadsto \color{blue}{\frac{\left(\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}\right) \cdot \frac{1}{a}}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}\]
    7. Applied simplify8.9

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

    if 5.386251553676296e-293 < b/2 < 1.7056098619160107e+47

    1. Initial program 9.6

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

    if 1.7056098619160107e+47 < b/2

    1. Initial program 35.9

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

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

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

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

Runtime

Time bar (total: 21.6s)Debug log

herbie shell --seed '#(633950927 2092594946 1442981 2827247922 2812758452 390991499)' 
(FPCore (a b/2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))