Average Error: 33.6 → 7.1
Time: 1.4m
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 -8.178143920194742 \cdot 10^{+98}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 1.553529129791208 \cdot 10^{-307}:\\ \;\;\;\;\frac{1}{a} \cdot \left(\sqrt{{b_2}^{2} - c \cdot a} - b_2\right)\\ \mathbf{elif}\;b_2 \le 1.3090904531855408 \cdot 10^{+124}:\\ \;\;\;\;\frac{-c}{\sqrt{{b_2}^{2} - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{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 < -8.178143920194742e+98

    1. Initial program 45.0

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

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

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

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

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

    if -8.178143920194742e+98 < b_2 < 1.553529129791208e-307

    1. Initial program 10.0

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

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

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

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

    if 1.553529129791208e-307 < b_2 < 1.3090904531855408e+124

    1. Initial program 33.7

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

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

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

      \[\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--33.8

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

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

      \[\leadsto \frac{\color{blue}{\frac{0 - a \cdot c}{a}}}{\sqrt{{b_2}^{2} - a \cdot c} + b_2}\]
    10. Using strategy rm
    11. Applied sub0-neg15.3

      \[\leadsto \frac{\frac{\color{blue}{-a \cdot c}}{a}}{\sqrt{{b_2}^{2} - a \cdot c} + b_2}\]
    12. Applied distribute-frac-neg15.3

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

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

    if 1.3090904531855408e+124 < b_2

    1. Initial program 59.8

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -8.178143920194742 \cdot 10^{+98}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 1.553529129791208 \cdot 10^{-307}:\\ \;\;\;\;\frac{1}{a} \cdot \left(\sqrt{{b_2}^{2} - c \cdot a} - b_2\right)\\ \mathbf{elif}\;b_2 \le 1.3090904531855408 \cdot 10^{+124}:\\ \;\;\;\;\frac{-c}{\sqrt{{b_2}^{2} - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Runtime

Time bar (total: 1.4m)Debug logProfile

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