Average Error: 33.9 → 9.8
Time: 13.8s
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.285761821828269498914963771383359026418 \cdot 10^{115}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 4.089744618622775294902023307017914843593 \cdot 10^{-73}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_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.285761821828269498914963771383359026418 \cdot 10^{115}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\

\mathbf{elif}\;b_2 \le 4.089744618622775294902023307017914843593 \cdot 10^{-73}:\\
\;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\

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

\end{array}
double f(double a, double b_2, double c) {
        double r23521 = b_2;
        double r23522 = -r23521;
        double r23523 = r23521 * r23521;
        double r23524 = a;
        double r23525 = c;
        double r23526 = r23524 * r23525;
        double r23527 = r23523 - r23526;
        double r23528 = sqrt(r23527);
        double r23529 = r23522 + r23528;
        double r23530 = r23529 / r23524;
        return r23530;
}

double f(double a, double b_2, double c) {
        double r23531 = b_2;
        double r23532 = -1.2857618218282695e+115;
        bool r23533 = r23531 <= r23532;
        double r23534 = 0.5;
        double r23535 = c;
        double r23536 = r23535 / r23531;
        double r23537 = r23534 * r23536;
        double r23538 = 2.0;
        double r23539 = a;
        double r23540 = r23531 / r23539;
        double r23541 = r23538 * r23540;
        double r23542 = r23537 - r23541;
        double r23543 = 4.089744618622775e-73;
        bool r23544 = r23531 <= r23543;
        double r23545 = r23531 * r23531;
        double r23546 = r23539 * r23535;
        double r23547 = r23545 - r23546;
        double r23548 = sqrt(r23547);
        double r23549 = r23548 - r23531;
        double r23550 = r23549 / r23539;
        double r23551 = -0.5;
        double r23552 = r23551 * r23536;
        double r23553 = r23544 ? r23550 : r23552;
        double r23554 = r23533 ? r23542 : r23553;
        return r23554;
}

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.2857618218282695e+115

    1. Initial program 50.7

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

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

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

    if -1.2857618218282695e+115 < b_2 < 4.089744618622775e-73

    1. Initial program 12.6

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

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Using strategy rm
    4. Applied clear-num12.7

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt12.7

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\]
    7. Applied associate-/l*12.7

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\sqrt[3]{1}}}}\]
    8. Simplified12.7

      \[\leadsto \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\color{blue}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    9. Using strategy rm
    10. Applied div-inv12.7

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

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

    if 4.089744618622775e-73 < b_2

    1. Initial program 53.3

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt53.3

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\]
    7. Applied associate-/l*53.3

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

      \[\leadsto \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\color{blue}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    9. Using strategy rm
    10. Applied div-inv53.3

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.285761821828269498914963771383359026418 \cdot 10^{115}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 4.089744618622775294902023307017914843593 \cdot 10^{-73}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Reproduce

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