Average Error: 34.5 → 10.1
Time: 5.4s
Precision: 64
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -4.706781135059311758856471716413486308072 \cdot 10^{-92}:\\ \;\;\;\;{\left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)}^{1}\\ \mathbf{elif}\;b_2 \le 5.722235152988638272816037483919181313619 \cdot 10^{98}:\\ \;\;\;\;{\left(\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\right)}^{1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\right)}^{1}\\ \end{array}\]
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
\mathbf{if}\;b_2 \le -4.706781135059311758856471716413486308072 \cdot 10^{-92}:\\
\;\;\;\;{\left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)}^{1}\\

\mathbf{elif}\;b_2 \le 5.722235152988638272816037483919181313619 \cdot 10^{98}:\\
\;\;\;\;{\left(\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\right)}^{1}\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\right)}^{1}\\

\end{array}
double f(double a, double b_2, double c) {
        double r16310 = b_2;
        double r16311 = -r16310;
        double r16312 = r16310 * r16310;
        double r16313 = a;
        double r16314 = c;
        double r16315 = r16313 * r16314;
        double r16316 = r16312 - r16315;
        double r16317 = sqrt(r16316);
        double r16318 = r16311 - r16317;
        double r16319 = r16318 / r16313;
        return r16319;
}

double f(double a, double b_2, double c) {
        double r16320 = b_2;
        double r16321 = -4.706781135059312e-92;
        bool r16322 = r16320 <= r16321;
        double r16323 = -0.5;
        double r16324 = c;
        double r16325 = r16324 / r16320;
        double r16326 = r16323 * r16325;
        double r16327 = 1.0;
        double r16328 = pow(r16326, r16327);
        double r16329 = 5.722235152988638e+98;
        bool r16330 = r16320 <= r16329;
        double r16331 = -r16320;
        double r16332 = r16320 * r16320;
        double r16333 = a;
        double r16334 = r16333 * r16324;
        double r16335 = r16332 - r16334;
        double r16336 = sqrt(r16335);
        double r16337 = r16331 - r16336;
        double r16338 = r16337 / r16333;
        double r16339 = pow(r16338, r16327);
        double r16340 = 0.5;
        double r16341 = r16340 * r16325;
        double r16342 = 2.0;
        double r16343 = r16320 / r16333;
        double r16344 = r16342 * r16343;
        double r16345 = r16341 - r16344;
        double r16346 = pow(r16345, r16327);
        double r16347 = r16330 ? r16339 : r16346;
        double r16348 = r16322 ? r16328 : r16347;
        return r16348;
}

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 < -4.706781135059312e-92

    1. Initial program 52.4

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

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Using strategy rm
    5. Applied pow152.4

      \[\leadsto \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \color{blue}{{\left(\frac{1}{a}\right)}^{1}}\]
    6. Applied pow152.4

      \[\leadsto \color{blue}{{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}^{1}} \cdot {\left(\frac{1}{a}\right)}^{1}\]
    7. Applied pow-prod-down52.4

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

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

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

    if -4.706781135059312e-92 < b_2 < 5.722235152988638e+98

    1. Initial program 12.6

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

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Using strategy rm
    5. Applied pow112.7

      \[\leadsto \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \color{blue}{{\left(\frac{1}{a}\right)}^{1}}\]
    6. Applied pow112.7

      \[\leadsto \color{blue}{{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}^{1}} \cdot {\left(\frac{1}{a}\right)}^{1}\]
    7. Applied pow-prod-down12.7

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

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

    if 5.722235152988638e+98 < b_2

    1. Initial program 47.1

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

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Using strategy rm
    5. Applied pow147.1

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

      \[\leadsto \color{blue}{{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}^{1}} \cdot {\left(\frac{1}{a}\right)}^{1}\]
    7. Applied pow-prod-down47.1

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

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

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

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

Reproduce

herbie shell --seed 2019353 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))