Average Error: 33.7 → 9.5
Time: 40.7s
Precision: 64
Internal Precision: 3392
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -7.629739319014833 \cdot 10^{+43}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.9633653677274763 \cdot 10^{-72}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le -1.8183968941270222 \cdot 10^{-110}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.332932000625843 \cdot 10^{-165}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 1.8344422394438925 \cdot 10^{+28}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{(\left(a \cdot \frac{c}{b_2}\right) \cdot \frac{-1}{2} + b_2)_*}{a}\\ \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.629739319014833e+43 or -1.9633653677274763e-72 < b_2 < -1.8183968941270222e-110

    1. Initial program 54.3

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification54.3

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied div-inv54.3

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

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

    if -7.629739319014833e+43 < b_2 < -1.9633653677274763e-72 or -1.8183968941270222e-110 < b_2 < -3.332932000625843e-165

    1. Initial program 36.8

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification36.8

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied div-inv36.8

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    5. Using strategy rm
    6. Applied flip--36.9

      \[\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}\]
    7. Applied associate-*l/36.9

      \[\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}}}\]
    8. Simplified15.3

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

    if -3.332932000625843e-165 < b_2 < 1.8344422394438925e+28

    1. Initial program 11.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification11.9

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied div-sub11.9

      \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]

    if 1.8344422394438925e+28 < b_2

    1. Initial program 34.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification34.1

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied div-sub34.1

      \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    5. Taylor expanded around inf 10.2

      \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}}}{a}\]
    6. Simplified6.0

      \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{(\left(\frac{c}{b_2} \cdot a\right) \cdot \frac{-1}{2} + b_2)_*}}{a}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -7.629739319014833 \cdot 10^{+43}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.9633653677274763 \cdot 10^{-72}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le -1.8183968941270222 \cdot 10^{-110}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.332932000625843 \cdot 10^{-165}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 1.8344422394438925 \cdot 10^{+28}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{(\left(a \cdot \frac{c}{b_2}\right) \cdot \frac{-1}{2} + b_2)_*}{a}\\ \end{array}\]

Runtime

Time bar (total: 40.7s)Debug logProfile

herbie shell --seed 2018252 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))