Average Error: 28.6 → 16.2
Time: 12.6s
Precision: 64
\[1.0536712127723509 \cdot 10^{-08} \lt a \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt b \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt c \lt 94906265.62425156\]
\[\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 1935.0528928047481:\\ \;\;\;\;\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 1935.0528928047481:\\
\;\;\;\;\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 r1688809 = b;
        double r1688810 = -r1688809;
        double r1688811 = r1688809 * r1688809;
        double r1688812 = 3.0;
        double r1688813 = a;
        double r1688814 = r1688812 * r1688813;
        double r1688815 = c;
        double r1688816 = r1688814 * r1688815;
        double r1688817 = r1688811 - r1688816;
        double r1688818 = sqrt(r1688817);
        double r1688819 = r1688810 + r1688818;
        double r1688820 = r1688819 / r1688814;
        return r1688820;
}

double f(double a, double b, double c) {
        double r1688821 = b;
        double r1688822 = 1935.0528928047481;
        bool r1688823 = r1688821 <= r1688822;
        double r1688824 = r1688821 * r1688821;
        double r1688825 = a;
        double r1688826 = 3.0;
        double r1688827 = c;
        double r1688828 = r1688826 * r1688827;
        double r1688829 = r1688825 * r1688828;
        double r1688830 = r1688824 - r1688829;
        double r1688831 = sqrt(r1688830);
        double r1688832 = r1688830 * r1688831;
        double r1688833 = r1688824 * r1688821;
        double r1688834 = r1688832 - r1688833;
        double r1688835 = r1688821 * r1688831;
        double r1688836 = r1688835 + r1688824;
        double r1688837 = r1688830 + r1688836;
        double r1688838 = r1688834 / r1688837;
        double r1688839 = r1688825 * r1688826;
        double r1688840 = r1688838 / r1688839;
        double r1688841 = -0.5;
        double r1688842 = r1688827 / r1688821;
        double r1688843 = r1688841 * r1688842;
        double r1688844 = r1688823 ? r1688840 : r1688843;
        return r1688844;
}

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 < 1935.0528928047481

    1. Initial program 17.5

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

      \[\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--17.6

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

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

      \[\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 1935.0528928047481 < b

    1. Initial program 36.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 1935.0528928047481:\\ \;\;\;\;\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, narrow range"
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))