Average Error: 33.4 → 12.5
Time: 23.7s
Precision: 64
Internal Precision: 3136
\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -2.6982430388941645 \cdot 10^{+133}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 5.360685025300708 \cdot 10^{-77}:\\ \;\;\;\;\frac{\sqrt{(b_2 \cdot b_2 + \left(\left(-c\right) \cdot a\right))_*} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.17722275955258 \cdot 10^{+60}:\\ \;\;\;\;\frac{\left(-c\right) \cdot a}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right) \cdot a}\\ \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 < -2.6982430388941645e+133

    1. Initial program 53.6

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

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

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

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

    if -2.6982430388941645e+133 < b_2 < 5.360685025300708e-77

    1. Initial program 12.4

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

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

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

    if 5.360685025300708e-77 < b_2 < 1.17722275955258e+60

    1. Initial program 40.5

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

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

      \[\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/43.2

      \[\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. Simplified17.3

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

    if 1.17722275955258e+60 < b_2

    1. Initial program 56.7

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Taylor expanded around inf 15.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 simplification12.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.6982430388941645 \cdot 10^{+133}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 5.360685025300708 \cdot 10^{-77}:\\ \;\;\;\;\frac{\sqrt{(b_2 \cdot b_2 + \left(\left(-c\right) \cdot a\right))_*} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.17722275955258 \cdot 10^{+60}:\\ \;\;\;\;\frac{\left(-c\right) \cdot a}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right) \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{a \cdot c}{b_2}}{a}\\ \end{array}\]

Runtime

Time bar (total: 23.7s)Debug logProfile

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