Average Error: 33.9 → 10.3
Time: 25.5s
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 -3.389509236151252 \cdot 10^{+144}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 8.206202096779753 \cdot 10^{-108}:\\ \;\;\;\;\frac{\sqrt{{b_2}^{2} - c \cdot a} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-2 \cdot \frac{b_2}{c}}\\ \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 3 regimes
  2. if b_2 < -3.389509236151252e+144

    1. Initial program 57.2

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

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

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

    if -3.389509236151252e+144 < b_2 < 8.206202096779753e-108

    1. Initial program 11.7

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

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

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

    if 8.206202096779753e-108 < b_2

    1. Initial program 51.8

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity51.8

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}{a}\]
    5. Applied associate-/l*51.8

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    6. Taylor expanded around 0 11.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.389509236151252 \cdot 10^{+144}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 8.206202096779753 \cdot 10^{-108}:\\ \;\;\;\;\frac{\sqrt{{b_2}^{2} - c \cdot a} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-2 \cdot \frac{b_2}{c}}\\ \end{array}\]

Runtime

Time bar (total: 25.5s)Debug logProfile

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