Average Error: 33.9 → 6.8
Time: 5.3s
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 \left(1 \cdot \frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \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 \left(1 \cdot \frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}\right)\\

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

\end{array}
double f(double a, double b_2, double c) {
        double r19663 = b_2;
        double r19664 = -r19663;
        double r19665 = r19663 * r19663;
        double r19666 = a;
        double r19667 = c;
        double r19668 = r19666 * r19667;
        double r19669 = r19665 - r19668;
        double r19670 = sqrt(r19669);
        double r19671 = r19664 + r19670;
        double r19672 = r19671 / r19666;
        return r19672;
}

double f(double a, double b_2, double c) {
        double r19673 = b_2;
        double r19674 = -9.268713688859225e+150;
        bool r19675 = r19673 <= r19674;
        double r19676 = 0.5;
        double r19677 = c;
        double r19678 = r19677 / r19673;
        double r19679 = r19676 * r19678;
        double r19680 = 2.0;
        double r19681 = a;
        double r19682 = r19673 / r19681;
        double r19683 = r19680 * r19682;
        double r19684 = r19679 - r19683;
        double r19685 = -1.2249666784418393e-279;
        bool r19686 = r19673 <= r19685;
        double r19687 = -r19673;
        double r19688 = r19673 * r19673;
        double r19689 = r19681 * r19677;
        double r19690 = r19688 - r19689;
        double r19691 = sqrt(r19690);
        double r19692 = r19687 + r19691;
        double r19693 = sqrt(r19692);
        double r19694 = r19681 / r19693;
        double r19695 = r19693 / r19694;
        double r19696 = 4.3957752798560445e+108;
        bool r19697 = r19673 <= r19696;
        double r19698 = 1.0;
        double r19699 = r19687 - r19691;
        double r19700 = r19677 / r19699;
        double r19701 = r19698 * r19700;
        double r19702 = r19698 * r19701;
        double r19703 = -0.5;
        double r19704 = r19703 * r19678;
        double r19705 = r19698 * r19704;
        double r19706 = r19697 ? r19702 : r19705;
        double r19707 = r19686 ? r19695 : r19706;
        double r19708 = r19675 ? r19684 : r19707;
        return r19708;
}

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 *-un-lft-identity14.7

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

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

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

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

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

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

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

      \[\leadsto 1 \cdot \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}}\]
    21. Applied times-frac9.7

      \[\leadsto 1 \cdot \color{blue}{\left(\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}}\right)}\]
    22. Simplified9.7

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

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

    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. Using strategy rm
    3. Applied flip-+60.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. Simplified32.8

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

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

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

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

      \[\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. Simplified32.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 *-un-lft-identity32.7

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

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)}\]
  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 \left(1 \cdot \frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \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))