Average Error: 33.9 → 9.9
Time: 25.1s
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 -2.410267969009899 \cdot 10^{-98}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 4.8539323749735836 \cdot 10^{+132}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \sqrt{b_2 \cdot b_2 - c \cdot a} \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \left(\frac{b_2}{a} - \frac{c}{b_2} \cdot \frac{1}{2}\right)\\ \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 < -2.410267969009899e-98

    1. Initial program 52.1

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied div-sub52.6

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

      \[\leadsto \frac{-b_2}{a} - \color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \frac{1}{a}}\]
    7. Taylor expanded around -inf 10.0

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

    if -2.410267969009899e-98 < b_2 < 4.8539323749735836e+132

    1. Initial program 11.8

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied div-sub11.8

      \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    5. Using strategy rm
    6. Applied div-inv11.9

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

    if 4.8539323749735836e+132 < b_2

    1. Initial program 53.0

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied div-sub53.0

      \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    5. Using strategy rm
    6. Applied div-inv53.0

      \[\leadsto \frac{-b_2}{a} - \color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \frac{1}{a}}\]
    7. Taylor expanded around inf 2.2

      \[\leadsto \frac{-b_2}{a} - \color{blue}{\left(\frac{b_2}{a} - \frac{1}{2} \cdot \frac{c}{b_2}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification9.9

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

Runtime

Time bar (total: 25.1s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes34.09.95.628.484.9%
herbie shell --seed 2018354 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))