Average Error: 33.7 → 8.2
Time: 46.0s
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 -6.175698466702255 \cdot 10^{+75}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -6.700500194371953 \cdot 10^{-230}:\\ \;\;\;\;\frac{\left(\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c}}\right) \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c}} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 4.9899278298790826 \cdot 10^{+82}:\\ \;\;\;\;\frac{-c}{\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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -6.175698466702255e+75

    1. Initial program 39.9

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

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

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

    if -6.175698466702255e+75 < b_2 < -6.700500194371953e-230

    1. Initial program 8.0

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

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

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

    if -6.700500194371953e-230 < b_2 < 4.9899278298790826e+82

    1. Initial program 29.7

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

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

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

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

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

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

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

    if 4.9899278298790826e+82 < b_2

    1. Initial program 57.5

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

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

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

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

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

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

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

      \[\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 simplification8.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -6.175698466702255 \cdot 10^{+75}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -6.700500194371953 \cdot 10^{-230}:\\ \;\;\;\;\frac{\left(\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c}}\right) \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c}} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 4.9899278298790826 \cdot 10^{+82}:\\ \;\;\;\;\frac{-c}{\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: 46.0s)Debug logProfile

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