Average Error: 29.1 → 16.3
Time: 15.9s
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 759.6594316796017:\\ \;\;\;\;\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 759.6594316796017:\\
\;\;\;\;\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 r1248664 = b;
        double r1248665 = -r1248664;
        double r1248666 = r1248664 * r1248664;
        double r1248667 = 3.0;
        double r1248668 = a;
        double r1248669 = r1248667 * r1248668;
        double r1248670 = c;
        double r1248671 = r1248669 * r1248670;
        double r1248672 = r1248666 - r1248671;
        double r1248673 = sqrt(r1248672);
        double r1248674 = r1248665 + r1248673;
        double r1248675 = r1248674 / r1248669;
        return r1248675;
}

double f(double a, double b, double c) {
        double r1248676 = b;
        double r1248677 = 759.6594316796017;
        bool r1248678 = r1248676 <= r1248677;
        double r1248679 = r1248676 * r1248676;
        double r1248680 = a;
        double r1248681 = 3.0;
        double r1248682 = c;
        double r1248683 = r1248681 * r1248682;
        double r1248684 = r1248680 * r1248683;
        double r1248685 = r1248679 - r1248684;
        double r1248686 = sqrt(r1248685);
        double r1248687 = r1248685 * r1248686;
        double r1248688 = r1248679 * r1248676;
        double r1248689 = r1248687 - r1248688;
        double r1248690 = r1248676 * r1248686;
        double r1248691 = r1248690 + r1248679;
        double r1248692 = r1248685 + r1248691;
        double r1248693 = r1248689 / r1248692;
        double r1248694 = r1248680 * r1248681;
        double r1248695 = r1248693 / r1248694;
        double r1248696 = -0.5;
        double r1248697 = r1248682 / r1248676;
        double r1248698 = r1248696 * r1248697;
        double r1248699 = r1248678 ? r1248695 : r1248698;
        return r1248699;
}

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

    1. Initial program 17.4

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

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

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

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

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

    1. Initial program 36.7

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 759.6594316796017:\\ \;\;\;\;\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 2019154 
(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)))