Average Error: 33.4 → 10.1
Time: 32.6s
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.8880468196997556 \cdot 10^{-80}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 2.743299671584071 \cdot 10^{+131}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{(b_2 \cdot b_2 + \left(a \cdot \left(-c\right)\right))_*}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b_2\right) - (\left(\frac{c}{b_2} \cdot a\right) \cdot \frac{-1}{2} + b_2)_*}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if b_2 < -2.8880468196997556e-80

    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{\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 fma-neg52.6

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

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

    if -2.8880468196997556e-80 < b_2 < 2.743299671584071e+131

    1. Initial program 12.2

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

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

      \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    5. Using strategy rm
    6. Applied fma-neg12.2

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

    if 2.743299671584071e+131 < b_2

    1. Initial program 53.3

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Taylor expanded around inf 9.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.8880468196997556 \cdot 10^{-80}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 2.743299671584071 \cdot 10^{+131}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{(b_2 \cdot b_2 + \left(a \cdot \left(-c\right)\right))_*}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b_2\right) - (\left(\frac{c}{b_2} \cdot a\right) \cdot \frac{-1}{2} + b_2)_*}{a}\\ \end{array}\]

Runtime

Time bar (total: 32.6s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes33.410.15.527.983.7%
herbie shell --seed 2018353 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))