Average Error: 33.7 → 10.3
Time: 51.3s
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 -1.4748699412762502 \cdot 10^{+80}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -5.73568019437528 \cdot 10^{-290}:\\ \;\;\;\;\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\frac{a}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\\ \mathbf{elif}\;b_2 \le 1.9492786133970534 \cdot 10^{+82}:\\ \;\;\;\;\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

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 < -1.4748699412762502e+80

    1. Initial program 40.9

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

      \[\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 -1.4748699412762502e+80 < b_2 < -5.73568019437528e-290

    1. Initial program 9.5

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

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

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

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

    if -5.73568019437528e-290 < b_2 < 1.9492786133970534e+82

    1. Initial program 31.5

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied flip--31.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/36.1

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

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

    if 1.9492786133970534e+82 < b_2

    1. Initial program 57.8

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied flip--57.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/58.1

      \[\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. Simplified30.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 distribute-frac-neg30.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.4748699412762502 \cdot 10^{+80}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -5.73568019437528 \cdot 10^{-290}:\\ \;\;\;\;\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\frac{a}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\\ \mathbf{elif}\;b_2 \le 1.9492786133970534 \cdot 10^{+82}:\\ \;\;\;\;\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: 51.3s)Debug logProfile

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