Average Error: 33.9 → 10.8
Time: 9.9s
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 -6.9315373378557038 \cdot 10^{-23}:\\ \;\;\;\;{\left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)}^{1}\\ \mathbf{elif}\;b_2 \le 1.77017414835012383 \cdot 10^{70}:\\ \;\;\;\;{\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 -6.9315373378557038 \cdot 10^{-23}:\\
\;\;\;\;{\left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)}^{1}\\

\mathbf{elif}\;b_2 \le 1.77017414835012383 \cdot 10^{70}:\\
\;\;\;\;{\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 r65 = b_2;
        double r66 = -r65;
        double r67 = r65 * r65;
        double r68 = a;
        double r69 = c;
        double r70 = r68 * r69;
        double r71 = r67 - r70;
        double r72 = sqrt(r71);
        double r73 = r66 - r72;
        double r74 = r73 / r68;
        return r74;
}

double f(double a, double b_2, double c) {
        double r75 = b_2;
        double r76 = -6.931537337855704e-23;
        bool r77 = r75 <= r76;
        double r78 = -0.5;
        double r79 = c;
        double r80 = r79 / r75;
        double r81 = r78 * r80;
        double r82 = 1.0;
        double r83 = pow(r81, r82);
        double r84 = 1.7701741483501238e+70;
        bool r85 = r75 <= r84;
        double r86 = -r75;
        double r87 = r75 * r75;
        double r88 = a;
        double r89 = r88 * r79;
        double r90 = r87 - r89;
        double r91 = sqrt(r90);
        double r92 = r86 - r91;
        double r93 = r92 / r88;
        double r94 = pow(r93, r82);
        double r95 = 0.5;
        double r96 = r95 * r80;
        double r97 = 2.0;
        double r98 = r75 / r88;
        double r99 = r97 * r98;
        double r100 = r96 - r99;
        double r101 = pow(r100, r82);
        double r102 = r85 ? r94 : r101;
        double r103 = r77 ? r83 : r102;
        return r103;
}

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 < -6.931537337855704e-23

    1. Initial program 54.3

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

      \[\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 pow154.3

      \[\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 pow154.3

      \[\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-down54.3

      \[\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. Simplified54.3

      \[\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 7.3

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

    if -6.931537337855704e-23 < b_2 < 1.7701741483501238e+70

    1. Initial program 15.5

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

      \[\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 pow115.6

      \[\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 pow115.6

      \[\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-down15.6

      \[\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. Simplified15.5

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

    if 1.7701741483501238e+70 < b_2

    1. Initial program 41.6

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

      \[\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 pow141.6

      \[\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 pow141.6

      \[\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-down41.6

      \[\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. Simplified41.6

      \[\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 5.4

      \[\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.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -6.9315373378557038 \cdot 10^{-23}:\\ \;\;\;\;{\left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)}^{1}\\ \mathbf{elif}\;b_2 \le 1.77017414835012383 \cdot 10^{70}:\\ \;\;\;\;{\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 2020025 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))