Average Error: 33.3 → 6.6
Time: 29.2s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -6.0480812527784834 \cdot 10^{+150}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le -3.719799124860053 \cdot 10^{-308}:\\ \;\;\;\;\frac{\sqrt{{b_2}^{2} - c \cdot a} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.0692676985676485 \cdot 10^{+82}:\\ \;\;\;\;\frac{-c}{\sqrt{{b_2}^{2} - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{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.0480812527784834e+150

    1. Initial program 59.1

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}{a}\]
    4. Using strategy rm
    5. Applied div-inv59.1

      \[\leadsto \color{blue}{\left(\sqrt{{b_2}^{2} - a \cdot c} - b_2\right) \cdot \frac{1}{a}}\]
    6. Taylor expanded around -inf 2.4

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

    if -6.0480812527784834e+150 < b_2 < -3.719799124860053e-308

    1. Initial program 8.8

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

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

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

    if -3.719799124860053e-308 < b_2 < 1.0692676985676485e+82

    1. Initial program 30.9

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}{a}\]
    4. Using strategy rm
    5. Applied div-inv31.0

      \[\leadsto \color{blue}{\left(\sqrt{{b_2}^{2} - a \cdot c} - b_2\right) \cdot \frac{1}{a}}\]
    6. Using strategy rm
    7. Applied flip--31.1

      \[\leadsto \color{blue}{\frac{\sqrt{{b_2}^{2} - a \cdot c} \cdot \sqrt{{b_2}^{2} - a \cdot c} - b_2 \cdot b_2}{\sqrt{{b_2}^{2} - a \cdot c} + b_2}} \cdot \frac{1}{a}\]
    8. Applied associate-*l/31.1

      \[\leadsto \color{blue}{\frac{\left(\sqrt{{b_2}^{2} - a \cdot c} \cdot \sqrt{{b_2}^{2} - a \cdot c} - b_2 \cdot b_2\right) \cdot \frac{1}{a}}{\sqrt{{b_2}^{2} - a \cdot c} + b_2}}\]
    9. Simplified15.2

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

      \[\leadsto \frac{\color{blue}{-1 \cdot c}}{\sqrt{{b_2}^{2} - a \cdot c} + b_2}\]
    11. Simplified8.7

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

    if 1.0692676985676485e+82 < b_2

    1. Initial program 58.4

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}{a}\]
    4. Using strategy rm
    5. Applied div-inv58.4

      \[\leadsto \color{blue}{\left(\sqrt{{b_2}^{2} - a \cdot c} - b_2\right) \cdot \frac{1}{a}}\]
    6. Taylor expanded around inf 3.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -6.0480812527784834 \cdot 10^{+150}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le -3.719799124860053 \cdot 10^{-308}:\\ \;\;\;\;\frac{\sqrt{{b_2}^{2} - c \cdot a} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.0692676985676485 \cdot 10^{+82}:\\ \;\;\;\;\frac{-c}{\sqrt{{b_2}^{2} - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \end{array}\]

Runtime

Time bar (total: 29.2s)Debug logProfile

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