Average Error: 33.7 → 10.5
Time: 54.8s
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 -2.227349250774133 \cdot 10^{+80}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.5616348041811878 \cdot 10^{-106}:\\ \;\;\;\;\frac{(\left(\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}\right) \cdot \left(\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}\right) + \left(-b_2\right))_*}{a}\\ \mathbf{elif}\;b_2 \le 5.893452234856823 \cdot 10^{+87}:\\ \;\;\;\;\frac{-\frac{a \cdot c}{a}}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{\left(b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}\right) + b_2}\\ \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.227349250774133e+80

    1. Initial program 41.0

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

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

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

    if -2.227349250774133e+80 < b_2 < 1.5616348041811878e-106

    1. Initial program 12.6

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt12.8

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}} - b_2}{a}\]
    5. Applied fma-neg12.8

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

    if 1.5616348041811878e-106 < b_2 < 5.893452234856823e+87

    1. Initial program 42.7

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

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

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

      \[\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.5

      \[\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 associate-/r*15.6

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

    if 5.893452234856823e+87 < b_2

    1. Initial program 58.1

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

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

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

      \[\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. Simplified31.0

      \[\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-neg31.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.227349250774133 \cdot 10^{+80}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.5616348041811878 \cdot 10^{-106}:\\ \;\;\;\;\frac{(\left(\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}\right) \cdot \left(\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}\right) + \left(-b_2\right))_*}{a}\\ \mathbf{elif}\;b_2 \le 5.893452234856823 \cdot 10^{+87}:\\ \;\;\;\;\frac{-\frac{a \cdot c}{a}}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{\left(b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}\right) + b_2}\\ \end{array}\]

Runtime

Time bar (total: 54.8s)Debug logProfile

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