Average Error: 33.9 → 6.8
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 -9.2687136888592249 \cdot 10^{150}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -1.2249666784418393 \cdot 10^{-279}:\\ \;\;\;\;\frac{\sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{\frac{a}{\sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\\ \mathbf{elif}\;b_2 \le 4.3957752798560445 \cdot 10^{108}:\\ \;\;\;\;1 \cdot \frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \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 -9.2687136888592249 \cdot 10^{150}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\

\mathbf{elif}\;b_2 \le -1.2249666784418393 \cdot 10^{-279}:\\
\;\;\;\;\frac{\sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{\frac{a}{\sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\\

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r19265 = b_2;
        double r19266 = -r19265;
        double r19267 = r19265 * r19265;
        double r19268 = a;
        double r19269 = c;
        double r19270 = r19268 * r19269;
        double r19271 = r19267 - r19270;
        double r19272 = sqrt(r19271);
        double r19273 = r19266 + r19272;
        double r19274 = r19273 / r19268;
        return r19274;
}

double f(double a, double b_2, double c) {
        double r19275 = b_2;
        double r19276 = -9.268713688859225e+150;
        bool r19277 = r19275 <= r19276;
        double r19278 = 0.5;
        double r19279 = c;
        double r19280 = r19279 / r19275;
        double r19281 = r19278 * r19280;
        double r19282 = 2.0;
        double r19283 = a;
        double r19284 = r19275 / r19283;
        double r19285 = r19282 * r19284;
        double r19286 = r19281 - r19285;
        double r19287 = -1.2249666784418393e-279;
        bool r19288 = r19275 <= r19287;
        double r19289 = -r19275;
        double r19290 = r19275 * r19275;
        double r19291 = r19283 * r19279;
        double r19292 = r19290 - r19291;
        double r19293 = sqrt(r19292);
        double r19294 = r19289 + r19293;
        double r19295 = sqrt(r19294);
        double r19296 = r19283 / r19295;
        double r19297 = r19295 / r19296;
        double r19298 = 4.3957752798560445e+108;
        bool r19299 = r19275 <= r19298;
        double r19300 = 1.0;
        double r19301 = r19289 - r19293;
        double r19302 = r19279 / r19301;
        double r19303 = r19300 * r19302;
        double r19304 = -0.5;
        double r19305 = r19304 * r19280;
        double r19306 = r19299 ? r19303 : r19305;
        double r19307 = r19288 ? r19297 : r19306;
        double r19308 = r19277 ? r19286 : r19307;
        return r19308;
}

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 4 regimes
  2. if b_2 < -9.268713688859225e+150

    1. Initial program 61.5

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 2.2

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

    if -9.268713688859225e+150 < b_2 < -1.2249666784418393e-279

    1. Initial program 8.2

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt8.5

      \[\leadsto \frac{\color{blue}{\sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    4. Applied associate-/l*8.6

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

    if -1.2249666784418393e-279 < b_2 < 4.3957752798560445e+108

    1. Initial program 31.4

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

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

      \[\leadsto \frac{\frac{\color{blue}{0 + a \cdot c}}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity16.6

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}}{a}\]
    7. Applied *-un-lft-identity16.6

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot \left(0 + a \cdot c\right)}}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{a}\]
    8. Applied times-frac16.6

      \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{0 + a \cdot c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    9. Simplified16.6

      \[\leadsto \frac{\color{blue}{1} \cdot \frac{0 + a \cdot c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    10. Simplified14.7

      \[\leadsto \frac{1 \cdot \color{blue}{\frac{a}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{c}}}}{a}\]
    11. Using strategy rm
    12. Applied clear-num14.7

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{c}}}\]
    14. Using strategy rm
    15. Applied *-un-lft-identity9.7

      \[\leadsto \frac{1}{\frac{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{\color{blue}{1 \cdot c}}}\]
    16. Applied times-frac9.7

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{c}}}\]
    17. Applied add-cube-cbrt9.7

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{c}}\]
    18. Applied times-frac9.7

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

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

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

    if 4.3957752798560445e+108 < b_2

    1. Initial program 60.4

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around inf 2.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -9.2687136888592249 \cdot 10^{150}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -1.2249666784418393 \cdot 10^{-279}:\\ \;\;\;\;\frac{\sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{\frac{a}{\sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\\ \mathbf{elif}\;b_2 \le 4.3957752798560445 \cdot 10^{108}:\\ \;\;\;\;1 \cdot \frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Reproduce

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