Average Error: 34.0 → 6.6
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 -5.68709029316059848 \cdot 10^{153}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -2.8005752259959611 \cdot 10^{-254}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}\\ \mathbf{elif}\;b \le 1.5052613683220879 \cdot 10^{123}:\\ \;\;\;\;\frac{\frac{1}{\frac{1}{c}}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \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 -5.68709029316059848 \cdot 10^{153}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r134054 = b;
        double r134055 = -r134054;
        double r134056 = r134054 * r134054;
        double r134057 = 3.0;
        double r134058 = a;
        double r134059 = r134057 * r134058;
        double r134060 = c;
        double r134061 = r134059 * r134060;
        double r134062 = r134056 - r134061;
        double r134063 = sqrt(r134062);
        double r134064 = r134055 + r134063;
        double r134065 = r134064 / r134059;
        return r134065;
}

double f(double a, double b, double c) {
        double r134066 = b;
        double r134067 = -5.6870902931605985e+153;
        bool r134068 = r134066 <= r134067;
        double r134069 = 0.5;
        double r134070 = c;
        double r134071 = r134070 / r134066;
        double r134072 = r134069 * r134071;
        double r134073 = 0.6666666666666666;
        double r134074 = a;
        double r134075 = r134066 / r134074;
        double r134076 = r134073 * r134075;
        double r134077 = r134072 - r134076;
        double r134078 = -2.800575225995961e-254;
        bool r134079 = r134066 <= r134078;
        double r134080 = -r134066;
        double r134081 = r134066 * r134066;
        double r134082 = 3.0;
        double r134083 = r134082 * r134074;
        double r134084 = r134083 * r134070;
        double r134085 = r134081 - r134084;
        double r134086 = sqrt(r134085);
        double r134087 = r134080 + r134086;
        double r134088 = r134087 / r134082;
        double r134089 = r134088 / r134074;
        double r134090 = 1.505261368322088e+123;
        bool r134091 = r134066 <= r134090;
        double r134092 = 1.0;
        double r134093 = r134092 / r134070;
        double r134094 = r134092 / r134093;
        double r134095 = r134080 - r134086;
        double r134096 = r134094 / r134095;
        double r134097 = -0.5;
        double r134098 = r134097 * r134071;
        double r134099 = r134091 ? r134096 : r134098;
        double r134100 = r134079 ? r134089 : r134099;
        double r134101 = r134068 ? r134077 : r134100;
        return r134101;
}

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

    1. Initial program 63.7

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

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

    if -5.6870902931605985e+153 < b < -2.800575225995961e-254

    1. Initial program 8.2

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied associate-/r*8.2

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

    if -2.800575225995961e-254 < b < 1.505261368322088e+123

    1. Initial program 31.7

      \[\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-+31.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. Simplified16.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 *-un-lft-identity16.7

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{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}\]
    9. Applied associate-/l*16.8

      \[\leadsto \color{blue}{\frac{\frac{1}{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}}}}}\]
    10. Simplified15.9

      \[\leadsto \frac{\frac{1}{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)}}\]
    11. Using strategy rm
    12. Applied associate-/r*15.6

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

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

    if 1.505261368322088e+123 < b

    1. Initial program 61.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -5.68709029316059848 \cdot 10^{153}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -2.8005752259959611 \cdot 10^{-254}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}\\ \mathbf{elif}\;b \le 1.5052613683220879 \cdot 10^{123}:\\ \;\;\;\;\frac{\frac{1}{\frac{1}{c}}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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