Average Error: 33.3 → 6.6
Time: 5.1s
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 -5.1275732900987989 \cdot 10^{153}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le -7.2607323080074732 \cdot 10^{-267}:\\ \;\;\;\;1 \cdot \left(1 \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\right)\\ \mathbf{elif}\;b_2 \le 6.93006590621689121 \cdot 10^{79}:\\ \;\;\;\;\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\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 -5.1275732900987989 \cdot 10^{153}:\\
\;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r68745 = b_2;
        double r68746 = -r68745;
        double r68747 = r68745 * r68745;
        double r68748 = a;
        double r68749 = c;
        double r68750 = r68748 * r68749;
        double r68751 = r68747 - r68750;
        double r68752 = sqrt(r68751);
        double r68753 = r68746 - r68752;
        double r68754 = r68753 / r68748;
        return r68754;
}

double f(double a, double b_2, double c) {
        double r68755 = b_2;
        double r68756 = -5.127573290098799e+153;
        bool r68757 = r68755 <= r68756;
        double r68758 = 1.0;
        double r68759 = -0.5;
        double r68760 = c;
        double r68761 = r68760 / r68755;
        double r68762 = r68759 * r68761;
        double r68763 = r68758 * r68762;
        double r68764 = -7.260732308007473e-267;
        bool r68765 = r68755 <= r68764;
        double r68766 = r68755 * r68755;
        double r68767 = a;
        double r68768 = r68767 * r68760;
        double r68769 = r68766 - r68768;
        double r68770 = sqrt(r68769);
        double r68771 = r68770 - r68755;
        double r68772 = r68760 / r68771;
        double r68773 = r68758 * r68772;
        double r68774 = r68758 * r68773;
        double r68775 = 6.930065906216891e+79;
        bool r68776 = r68755 <= r68775;
        double r68777 = -r68755;
        double r68778 = r68777 / r68767;
        double r68779 = r68770 / r68767;
        double r68780 = r68778 - r68779;
        double r68781 = 0.5;
        double r68782 = r68781 * r68761;
        double r68783 = 2.0;
        double r68784 = r68755 / r68767;
        double r68785 = r68783 * r68784;
        double r68786 = r68782 - r68785;
        double r68787 = r68758 * r68786;
        double r68788 = r68776 ? r68780 : r68787;
        double r68789 = r68765 ? r68774 : r68788;
        double r68790 = r68757 ? r68763 : r68789;
        return r68790;
}

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 < -5.127573290098799e+153

    1. Initial program 63.9

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

      \[\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. Simplified38.2

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

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity38.2

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    10. Simplified38.2

      \[\leadsto \frac{\color{blue}{1} \cdot \frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\]
    11. Simplified38.0

      \[\leadsto \frac{1 \cdot \color{blue}{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}}{a}\]
    12. Using strategy rm
    13. Applied *-un-lft-identity38.0

      \[\leadsto \frac{1 \cdot \frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}{\color{blue}{1 \cdot a}}\]
    14. Applied times-frac38.0

      \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}{a}}\]
    15. Simplified38.0

      \[\leadsto \color{blue}{1} \cdot \frac{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}{a}\]
    16. Simplified38.0

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

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

    if -5.127573290098799e+153 < b_2 < -7.260732308007473e-267

    1. Initial program 34.2

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

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

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

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity15.2

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    10. Simplified15.2

      \[\leadsto \frac{\color{blue}{1} \cdot \frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\]
    11. Simplified13.4

      \[\leadsto \frac{1 \cdot \color{blue}{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}}{a}\]
    12. Using strategy rm
    13. Applied *-un-lft-identity13.4

      \[\leadsto \frac{1 \cdot \frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}{\color{blue}{1 \cdot a}}\]
    14. Applied times-frac13.4

      \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}{a}}\]
    15. Simplified13.4

      \[\leadsto \color{blue}{1} \cdot \frac{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}{a}\]
    16. Simplified8.0

      \[\leadsto 1 \cdot \color{blue}{\frac{1}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}\]
    17. Using strategy rm
    18. Applied *-un-lft-identity8.0

      \[\leadsto 1 \cdot \frac{1}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{\color{blue}{1 \cdot c}}}\]
    19. Applied *-un-lft-identity8.0

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

      \[\leadsto 1 \cdot \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}\]
    21. Applied add-cube-cbrt8.0

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

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

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

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

    if -7.260732308007473e-267 < b_2 < 6.930065906216891e+79

    1. Initial program 9.8

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

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

    if 6.930065906216891e+79 < b_2

    1. Initial program 41.8

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

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

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

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity61.7

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    10. Simplified61.7

      \[\leadsto \frac{\color{blue}{1} \cdot \frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\]
    11. Simplified61.6

      \[\leadsto \frac{1 \cdot \color{blue}{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}}{a}\]
    12. Using strategy rm
    13. Applied *-un-lft-identity61.6

      \[\leadsto \frac{1 \cdot \frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}{\color{blue}{1 \cdot a}}\]
    14. Applied times-frac61.6

      \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}{a}}\]
    15. Simplified61.6

      \[\leadsto \color{blue}{1} \cdot \frac{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}{a}\]
    16. Simplified61.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -5.1275732900987989 \cdot 10^{153}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le -7.2607323080074732 \cdot 10^{-267}:\\ \;\;\;\;1 \cdot \left(1 \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\right)\\ \mathbf{elif}\;b_2 \le 6.93006590621689121 \cdot 10^{79}:\\ \;\;\;\;\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020003 
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))