Average Error: 33.3 → 6.7
Time: 32.6s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -4.2753084567737145 \cdot 10^{+114}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.6836776246710433 \cdot 10^{-265}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 3.789721845964365 \cdot 10^{+84}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b_2\right) - (\left(\frac{c}{b_2} \cdot a\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 < -4.2753084567737145e+114

    1. Initial program 59.6

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

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

    if -4.2753084567737145e+114 < b_2 < -1.6836776246710433e-265

    1. Initial program 34.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity34.1

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    4. Applied *-un-lft-identity34.1

      \[\leadsto \frac{\color{blue}{1 \cdot \left(-b_2\right)} - 1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    5. Applied distribute-lft-out--34.1

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{a}\]
    6. Applied associate-/l*34.2

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    7. Using strategy rm
    8. Applied div-inv34.2

      \[\leadsto \frac{1}{\color{blue}{a \cdot \frac{1}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    9. Applied associate-/r*34.2

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

      \[\leadsto \frac{\frac{1}{a}}{\frac{1}{\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}}}}}\]
    12. Applied associate-/r/34.4

      \[\leadsto \frac{\frac{1}{a}}{\color{blue}{\frac{1}{\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)}}\]
    13. Applied *-un-lft-identity34.4

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{1}{a}}}{\frac{1}{\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)}\]
    14. Applied times-frac38.3

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{\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 \frac{\frac{1}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    15. Simplified20.0

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

      \[\leadsto \left(a \cdot c\right) \cdot \color{blue}{\frac{\frac{1}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}\]
    17. Using strategy rm
    18. Applied pow120.0

      \[\leadsto \left(a \cdot c\right) \cdot \color{blue}{{\left(\frac{\frac{1}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\right)}^{1}}\]
    19. Applied pow120.0

      \[\leadsto \color{blue}{{\left(a \cdot c\right)}^{1}} \cdot {\left(\frac{\frac{1}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\right)}^{1}\]
    20. Applied pow-prod-down20.0

      \[\leadsto \color{blue}{{\left(\left(a \cdot c\right) \cdot \frac{\frac{1}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\right)}^{1}}\]
    21. Simplified7.7

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

    if -1.6836776246710433e-265 < b_2 < 3.789721845964365e+84

    1. Initial program 9.8

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity9.8

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    4. Applied *-un-lft-identity9.8

      \[\leadsto \frac{\color{blue}{1 \cdot \left(-b_2\right)} - 1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    5. Applied distribute-lft-out--9.8

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{a}\]
    6. Applied associate-/l*10.0

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

    if 3.789721845964365e+84 < b_2

    1. Initial program 41.8

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

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{\left(b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}\right)}}{a}\]
    3. Simplified4.6

      \[\leadsto \frac{\left(-b_2\right) - \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 simplification6.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.2753084567737145 \cdot 10^{+114}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.6836776246710433 \cdot 10^{-265}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 3.789721845964365 \cdot 10^{+84}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b_2\right) - (\left(\frac{c}{b_2} \cdot a\right) \cdot \frac{-1}{2} + b_2)_*}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019030 +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))