Average Error: 34.3 → 9.0
Time: 4.9s
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 -1.7884666465826799 \cdot 10^{121}:\\ \;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le -4.9276367402926466 \cdot 10^{-151}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 1.5374040547673884 \cdot 10^{153}:\\ \;\;\;\;\frac{1}{\left(1 \cdot \frac{1}{c}\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - {\left(3 \cdot \left(a \cdot c\right)\right)}^{1}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(1 \cdot \frac{1}{c}\right) \cdot \left(1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b\right)}\\ \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 -1.7884666465826799 \cdot 10^{121}:\\
\;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r132051 = b;
        double r132052 = -r132051;
        double r132053 = r132051 * r132051;
        double r132054 = 3.0;
        double r132055 = a;
        double r132056 = r132054 * r132055;
        double r132057 = c;
        double r132058 = r132056 * r132057;
        double r132059 = r132053 - r132058;
        double r132060 = sqrt(r132059);
        double r132061 = r132052 + r132060;
        double r132062 = r132061 / r132056;
        return r132062;
}

double f(double a, double b, double c) {
        double r132063 = b;
        double r132064 = -1.78846664658268e+121;
        bool r132065 = r132063 <= r132064;
        double r132066 = 1.5;
        double r132067 = a;
        double r132068 = c;
        double r132069 = r132067 * r132068;
        double r132070 = r132069 / r132063;
        double r132071 = r132066 * r132070;
        double r132072 = 2.0;
        double r132073 = r132072 * r132063;
        double r132074 = r132071 - r132073;
        double r132075 = 3.0;
        double r132076 = r132075 * r132067;
        double r132077 = r132074 / r132076;
        double r132078 = -4.9276367402926466e-151;
        bool r132079 = r132063 <= r132078;
        double r132080 = -r132063;
        double r132081 = r132063 * r132063;
        double r132082 = r132076 * r132068;
        double r132083 = r132081 - r132082;
        double r132084 = sqrt(r132083);
        double r132085 = sqrt(r132084);
        double r132086 = r132085 * r132085;
        double r132087 = r132080 + r132086;
        double r132088 = r132087 / r132076;
        double r132089 = 1.5374040547673884e+153;
        bool r132090 = r132063 <= r132089;
        double r132091 = 1.0;
        double r132092 = r132091 / r132068;
        double r132093 = r132091 * r132092;
        double r132094 = r132075 * r132069;
        double r132095 = pow(r132094, r132091);
        double r132096 = r132081 - r132095;
        double r132097 = sqrt(r132096);
        double r132098 = r132080 - r132097;
        double r132099 = r132093 * r132098;
        double r132100 = r132091 / r132099;
        double r132101 = r132093 * r132074;
        double r132102 = r132091 / r132101;
        double r132103 = r132090 ? r132100 : r132102;
        double r132104 = r132079 ? r132088 : r132103;
        double r132105 = r132065 ? r132077 : r132104;
        return r132105;
}

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 < -1.78846664658268e+121

    1. Initial program 52.4

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

      \[\leadsto \frac{\color{blue}{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}}{3 \cdot a}\]

    if -1.78846664658268e+121 < b < -4.9276367402926466e-151

    1. Initial program 6.5

      \[\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-sqrt6.5

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

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

    if -4.9276367402926466e-151 < b < 1.5374040547673884e+153

    1. Initial program 30.4

      \[\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-+30.8

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

      \[\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 clear-num15.9

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

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

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

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

      \[\leadsto \frac{1}{\left(1 \cdot \color{blue}{\frac{1}{c}}\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\]
    12. Using strategy rm
    13. Applied pow110.0

      \[\leadsto \frac{1}{\left(1 \cdot \frac{1}{c}\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot \color{blue}{{c}^{1}}}\right)}\]
    14. Applied pow110.0

      \[\leadsto \frac{1}{\left(1 \cdot \frac{1}{c}\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot \color{blue}{{a}^{1}}\right) \cdot {c}^{1}}\right)}\]
    15. Applied pow110.0

      \[\leadsto \frac{1}{\left(1 \cdot \frac{1}{c}\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(\color{blue}{{3}^{1}} \cdot {a}^{1}\right) \cdot {c}^{1}}\right)}\]
    16. Applied pow-prod-down10.0

      \[\leadsto \frac{1}{\left(1 \cdot \frac{1}{c}\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \color{blue}{{\left(3 \cdot a\right)}^{1}} \cdot {c}^{1}}\right)}\]
    17. Applied pow-prod-down10.0

      \[\leadsto \frac{1}{\left(1 \cdot \frac{1}{c}\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \color{blue}{{\left(\left(3 \cdot a\right) \cdot c\right)}^{1}}}\right)}\]
    18. Simplified10.0

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

    if 1.5374040547673884e+153 < b

    1. Initial program 63.9

      \[\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-+63.9

      \[\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. Simplified37.5

      \[\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 clear-num37.5

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.7884666465826799 \cdot 10^{121}:\\ \;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le -4.9276367402926466 \cdot 10^{-151}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 1.5374040547673884 \cdot 10^{153}:\\ \;\;\;\;\frac{1}{\left(1 \cdot \frac{1}{c}\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - {\left(3 \cdot \left(a \cdot c\right)\right)}^{1}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(1 \cdot \frac{1}{c}\right) \cdot \left(1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b\right)}\\ \end{array}\]

Reproduce

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