Average Error: 43.6 → 11.3
Time: 11.4s
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\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 0.0015483000136869431:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - a \cdot \left(3 \cdot c\right)\right) \cdot \sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - a \cdot \left(3 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} + b \cdot b\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \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 0.0015483000136869431:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - a \cdot \left(3 \cdot c\right)\right) \cdot \sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - a \cdot \left(3 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} + b \cdot b\right)}}{a \cdot 3}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1075839 = b;
        double r1075840 = -r1075839;
        double r1075841 = r1075839 * r1075839;
        double r1075842 = 3.0;
        double r1075843 = a;
        double r1075844 = r1075842 * r1075843;
        double r1075845 = c;
        double r1075846 = r1075844 * r1075845;
        double r1075847 = r1075841 - r1075846;
        double r1075848 = sqrt(r1075847);
        double r1075849 = r1075840 + r1075848;
        double r1075850 = r1075849 / r1075844;
        return r1075850;
}

double f(double a, double b, double c) {
        double r1075851 = b;
        double r1075852 = 0.0015483000136869431;
        bool r1075853 = r1075851 <= r1075852;
        double r1075854 = r1075851 * r1075851;
        double r1075855 = a;
        double r1075856 = 3.0;
        double r1075857 = c;
        double r1075858 = r1075856 * r1075857;
        double r1075859 = r1075855 * r1075858;
        double r1075860 = r1075854 - r1075859;
        double r1075861 = sqrt(r1075860);
        double r1075862 = r1075860 * r1075861;
        double r1075863 = r1075854 * r1075851;
        double r1075864 = r1075862 - r1075863;
        double r1075865 = r1075851 * r1075861;
        double r1075866 = r1075865 + r1075854;
        double r1075867 = r1075860 + r1075866;
        double r1075868 = r1075864 / r1075867;
        double r1075869 = r1075855 * r1075856;
        double r1075870 = r1075868 / r1075869;
        double r1075871 = -0.5;
        double r1075872 = r1075857 / r1075851;
        double r1075873 = r1075871 * r1075872;
        double r1075874 = r1075853 ? r1075870 : r1075873;
        return r1075874;
}

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 2 regimes
  2. if b < 0.0015483000136869431

    1. Initial program 20.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Simplified20.1

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

      \[\leadsto \frac{\color{blue}{\frac{{\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}^{3} - {b}^{3}}{\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 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot b\right)}}}{3 \cdot a}\]
    5. Simplified19.4

      \[\leadsto \frac{\frac{\color{blue}{\sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} \cdot \left(b \cdot b - \left(3 \cdot c\right) \cdot a\right) - \left(b \cdot b\right) \cdot b}}{\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 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot b\right)}}{3 \cdot a}\]
    6. Simplified19.4

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

    if 0.0015483000136869431 < b

    1. Initial program 45.8

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Simplified45.8

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification11.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 0.0015483000136869431:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - a \cdot \left(3 \cdot c\right)\right) \cdot \sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - a \cdot \left(3 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} + b \cdot b\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2019156 
(FPCore (a b c)
  :name "Cubic critical, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))