Average Error: 32.9 → 10.5
Time: 22.8s
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 -1.3801296442484604 \cdot 10^{+103}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 4.3540765153403165 \cdot 10^{-10}:\\ \;\;\;\;\frac{\sqrt{\left(-c \cdot a\right) + b_2 \cdot b_2} - b_2}{a}\\ \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 3 regimes
  2. if b_2 < -1.3801296442484604e+103

    1. Initial program 46.2

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{b_2 \cdot b_2 + \left(-a \cdot c\right)}} - b_2}{a}\]
    5. Taylor expanded around -inf 4.4

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

    if -1.3801296442484604e+103 < b_2 < 4.3540765153403165e-10

    1. Initial program 15.0

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

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

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

    if 4.3540765153403165e-10 < b_2

    1. Initial program 54.1

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{b_2 \cdot b_2 + \left(-a \cdot c\right)}} - b_2}{a}\]
    5. Taylor expanded around inf 6.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.3801296442484604 \cdot 10^{+103}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 4.3540765153403165 \cdot 10^{-10}:\\ \;\;\;\;\frac{\sqrt{\left(-c \cdot a\right) + b_2 \cdot b_2} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \end{array}\]

Runtime

Time bar (total: 22.8s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes32.910.55.727.282.1%
herbie shell --seed 2018352 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))