Average Error: 34.3 → 8.8
Time: 6.4s
Precision: 64
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -2.14194017547317126 \cdot 10^{130}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -1.7200956384996044 \cdot 10^{-207}:\\ \;\;\;\;\frac{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{\frac{3 \cdot a}{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}\\ \mathbf{elif}\;b \le 9.81728345733967385 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{3 \cdot a}{\frac{-3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{-c}}}{a}\\ \mathbf{elif}\;b \le 2.48738671905241884 \cdot 10^{30}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le 7.69055682681544686 \cdot 10^{121}:\\ \;\;\;\;\frac{\frac{3 \cdot a}{\frac{-3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{-c}}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le -2.14194017547317126 \cdot 10^{130}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\

\mathbf{elif}\;b \le -1.7200956384996044 \cdot 10^{-207}:\\
\;\;\;\;\frac{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{\frac{3 \cdot a}{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}\\

\mathbf{elif}\;b \le 9.81728345733967385 \cdot 10^{-8}:\\
\;\;\;\;\frac{\frac{3 \cdot a}{\frac{-3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{-c}}}{a}\\

\mathbf{elif}\;b \le 2.48738671905241884 \cdot 10^{30}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\

\mathbf{elif}\;b \le 7.69055682681544686 \cdot 10^{121}:\\
\;\;\;\;\frac{\frac{3 \cdot a}{\frac{-3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{-c}}}{a}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\

\end{array}
double f(double a, double b, double c) {
        double r259780 = b;
        double r259781 = -r259780;
        double r259782 = r259780 * r259780;
        double r259783 = 3.0;
        double r259784 = a;
        double r259785 = r259783 * r259784;
        double r259786 = c;
        double r259787 = r259785 * r259786;
        double r259788 = r259782 - r259787;
        double r259789 = sqrt(r259788);
        double r259790 = r259781 + r259789;
        double r259791 = r259790 / r259785;
        return r259791;
}

double f(double a, double b, double c) {
        double r259792 = b;
        double r259793 = -2.1419401754731713e+130;
        bool r259794 = r259792 <= r259793;
        double r259795 = 0.5;
        double r259796 = c;
        double r259797 = r259796 / r259792;
        double r259798 = r259795 * r259797;
        double r259799 = 0.6666666666666666;
        double r259800 = a;
        double r259801 = r259792 / r259800;
        double r259802 = r259799 * r259801;
        double r259803 = r259798 - r259802;
        double r259804 = -1.7200956384996044e-207;
        bool r259805 = r259792 <= r259804;
        double r259806 = -r259792;
        double r259807 = r259792 * r259792;
        double r259808 = 3.0;
        double r259809 = r259808 * r259800;
        double r259810 = r259809 * r259796;
        double r259811 = r259807 - r259810;
        double r259812 = sqrt(r259811);
        double r259813 = r259806 + r259812;
        double r259814 = sqrt(r259813);
        double r259815 = r259809 / r259814;
        double r259816 = r259814 / r259815;
        double r259817 = 9.817283457339674e-08;
        bool r259818 = r259792 <= r259817;
        double r259819 = r259806 - r259812;
        double r259820 = r259808 * r259819;
        double r259821 = -r259820;
        double r259822 = -r259796;
        double r259823 = r259821 / r259822;
        double r259824 = r259809 / r259823;
        double r259825 = r259824 / r259800;
        double r259826 = 2.4873867190524188e+30;
        bool r259827 = r259792 <= r259826;
        double r259828 = -0.5;
        double r259829 = r259828 * r259797;
        double r259830 = 7.690556826815447e+121;
        bool r259831 = r259792 <= r259830;
        double r259832 = r259831 ? r259825 : r259829;
        double r259833 = r259827 ? r259829 : r259832;
        double r259834 = r259818 ? r259825 : r259833;
        double r259835 = r259805 ? r259816 : r259834;
        double r259836 = r259794 ? r259803 : r259835;
        return r259836;
}

Error

Bits error versus a

Bits error versus b

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.1419401754731713e+130

    1. Initial program 57.3

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}}\]

    if -2.1419401754731713e+130 < b < -1.7200956384996044e-207

    1. Initial program 7.3

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

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

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

    if -1.7200956384996044e-207 < b < 9.817283457339674e-08 or 2.4873867190524188e+30 < b < 7.690556826815447e+121

    1. Initial program 28.6

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

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

      \[\leadsto \frac{\frac{\color{blue}{0 + 3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied associate-/r*16.4

      \[\leadsto \color{blue}{\frac{\frac{\frac{0 + 3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3}}{a}}\]
    7. Simplified16.4

      \[\leadsto \frac{\color{blue}{\frac{3 \cdot \left(a \cdot c\right)}{3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}{a}\]
    8. Using strategy rm
    9. Applied frac-2neg16.4

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

      \[\leadsto \frac{\frac{\color{blue}{-\left(3 \cdot a\right) \cdot c}}{-3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}{a}\]
    11. Using strategy rm
    12. Applied distribute-rgt-neg-in16.4

      \[\leadsto \frac{\frac{\color{blue}{\left(3 \cdot a\right) \cdot \left(-c\right)}}{-3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}{a}\]
    13. Applied associate-/l*14.5

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

    if 9.817283457339674e-08 < b < 2.4873867190524188e+30 or 7.690556826815447e+121 < b

    1. Initial program 58.9

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification8.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.14194017547317126 \cdot 10^{130}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -1.7200956384996044 \cdot 10^{-207}:\\ \;\;\;\;\frac{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{\frac{3 \cdot a}{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}\\ \mathbf{elif}\;b \le 9.81728345733967385 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{3 \cdot a}{\frac{-3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{-c}}}{a}\\ \mathbf{elif}\;b \le 2.48738671905241884 \cdot 10^{30}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le 7.69055682681544686 \cdot 10^{121}:\\ \;\;\;\;\frac{\frac{3 \cdot a}{\frac{-3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{-c}}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2020036 
(FPCore (a b c)
  :name "Cubic critical"
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))