Average Error: 34.4 → 10.2
Time: 21.0s
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 -1.763315479739403460017265344144602342789 \cdot 10^{89}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 9.136492990928292133394320076175633285536 \cdot 10^{-23}:\\ \;\;\;\;\frac{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\frac{1}{2}} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \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 -1.763315479739403460017265344144602342789 \cdot 10^{89}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\

\mathbf{elif}\;b_2 \le 9.136492990928292133394320076175633285536 \cdot 10^{-23}:\\
\;\;\;\;\frac{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\frac{1}{2}} - b_2}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\

\end{array}
double f(double a, double b_2, double c) {
        double r845569 = b_2;
        double r845570 = -r845569;
        double r845571 = r845569 * r845569;
        double r845572 = a;
        double r845573 = c;
        double r845574 = r845572 * r845573;
        double r845575 = r845571 - r845574;
        double r845576 = sqrt(r845575);
        double r845577 = r845570 + r845576;
        double r845578 = r845577 / r845572;
        return r845578;
}

double f(double a, double b_2, double c) {
        double r845579 = b_2;
        double r845580 = -1.7633154797394035e+89;
        bool r845581 = r845579 <= r845580;
        double r845582 = 0.5;
        double r845583 = c;
        double r845584 = r845583 / r845579;
        double r845585 = r845582 * r845584;
        double r845586 = a;
        double r845587 = r845579 / r845586;
        double r845588 = 2.0;
        double r845589 = r845587 * r845588;
        double r845590 = r845585 - r845589;
        double r845591 = 9.136492990928292e-23;
        bool r845592 = r845579 <= r845591;
        double r845593 = r845579 * r845579;
        double r845594 = r845583 * r845586;
        double r845595 = r845593 - r845594;
        double r845596 = pow(r845595, r845582);
        double r845597 = r845596 - r845579;
        double r845598 = r845597 / r845586;
        double r845599 = -0.5;
        double r845600 = r845584 * r845599;
        double r845601 = r845592 ? r845598 : r845600;
        double r845602 = r845581 ? r845590 : r845601;
        return r845602;
}

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.7633154797394035e+89

    1. Initial program 45.7

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

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

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

    if -1.7633154797394035e+89 < b_2 < 9.136492990928292e-23

    1. Initial program 15.0

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

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt15.4

      \[\leadsto \frac{\sqrt{\color{blue}{\left(\sqrt[3]{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt[3]{b_2 \cdot b_2 - a \cdot c}\right) \cdot \sqrt[3]{b_2 \cdot b_2 - a \cdot c}}} - b_2}{a}\]
    5. Using strategy rm
    6. Applied pow1/317.5

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

      \[\leadsto \frac{\sqrt{\left(\sqrt[3]{b_2 \cdot b_2 - a \cdot c} \cdot \color{blue}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{\frac{1}{3}}}\right) \cdot {\left(b_2 \cdot b_2 - a \cdot c\right)}^{\frac{1}{3}}} - b_2}{a}\]
    8. Applied pow1/318.6

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

      \[\leadsto \frac{\sqrt{\color{blue}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{1}{3} + \frac{1}{3}\right)}} \cdot {\left(b_2 \cdot b_2 - a \cdot c\right)}^{\frac{1}{3}}} - b_2}{a}\]
    10. Applied pow-prod-up15.0

      \[\leadsto \frac{\sqrt{\color{blue}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\left(\frac{1}{3} + \frac{1}{3}\right) + \frac{1}{3}\right)}}} - b_2}{a}\]
    11. Applied sqrt-pow115.0

      \[\leadsto \frac{\color{blue}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{\left(\frac{1}{3} + \frac{1}{3}\right) + \frac{1}{3}}{2}\right)}} - b_2}{a}\]
    12. Simplified15.0

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

    if 9.136492990928292e-23 < b_2

    1. Initial program 55.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.763315479739403460017265344144602342789 \cdot 10^{89}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 9.136492990928292133394320076175633285536 \cdot 10^{-23}:\\ \;\;\;\;\frac{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\frac{1}{2}} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019172 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))