Average Error: 34.5 → 9.2
Time: 25.6s
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 -3.819497819135284 \cdot 10^{+153}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -7.597049051112231 \cdot 10^{-299}:\\ \;\;\;\;\frac{\sqrt{(b_2 \cdot b_2 + \left(\left(-c\right) \cdot a\right))_*} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.9814699145958919 \cdot 10^{+136}:\\ \;\;\;\;\frac{-c}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{a \cdot c}{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 < -3.819497819135284e+153

    1. Initial program 60.5

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification60.5

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied fma-neg60.5

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

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

    if -3.819497819135284e+153 < b_2 < -7.597049051112231e-299

    1. Initial program 9.2

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied fma-neg9.2

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

    if -7.597049051112231e-299 < b_2 < 1.9814699145958919e+136

    1. Initial program 33.9

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied flip--34.0

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - b_2 \cdot b_2}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}}}{a}\]
    5. Applied associate-/l/37.6

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

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

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

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

    if 1.9814699145958919e+136 < b_2

    1. Initial program 61.1

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Taylor expanded around inf 14.3

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{a \cdot c}{b_2}}}{a}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.819497819135284 \cdot 10^{+153}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -7.597049051112231 \cdot 10^{-299}:\\ \;\;\;\;\frac{\sqrt{(b_2 \cdot b_2 + \left(\left(-c\right) \cdot a\right))_*} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.9814699145958919 \cdot 10^{+136}:\\ \;\;\;\;\frac{-c}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{a \cdot c}{b_2}}{a}\\ \end{array}\]

Runtime

Time bar (total: 25.6s)Debug logProfile

herbie shell --seed 2018254 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))