Average Error: 28.8 → 16.2
Time: 16.0s
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 563.9094021205955:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right)}}{3 \cdot a}\\ \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 563.9094021205955:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right)}}{3 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r5182280 = b;
        double r5182281 = -r5182280;
        double r5182282 = r5182280 * r5182280;
        double r5182283 = 3.0;
        double r5182284 = a;
        double r5182285 = r5182283 * r5182284;
        double r5182286 = c;
        double r5182287 = r5182285 * r5182286;
        double r5182288 = r5182282 - r5182287;
        double r5182289 = sqrt(r5182288);
        double r5182290 = r5182281 + r5182289;
        double r5182291 = r5182290 / r5182285;
        return r5182291;
}

double f(double a, double b, double c) {
        double r5182292 = b;
        double r5182293 = 563.9094021205955;
        bool r5182294 = r5182292 <= r5182293;
        double r5182295 = r5182292 * r5182292;
        double r5182296 = c;
        double r5182297 = 3.0;
        double r5182298 = a;
        double r5182299 = r5182297 * r5182298;
        double r5182300 = r5182296 * r5182299;
        double r5182301 = r5182295 - r5182300;
        double r5182302 = sqrt(r5182301);
        double r5182303 = r5182301 * r5182302;
        double r5182304 = r5182295 * r5182292;
        double r5182305 = r5182303 - r5182304;
        double r5182306 = r5182292 * r5182302;
        double r5182307 = r5182306 + r5182295;
        double r5182308 = r5182301 + r5182307;
        double r5182309 = r5182305 / r5182308;
        double r5182310 = r5182309 / r5182299;
        double r5182311 = -0.5;
        double r5182312 = r5182296 / r5182292;
        double r5182313 = r5182311 * r5182312;
        double r5182314 = r5182294 ? r5182310 : r5182313;
        return r5182314;
}

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

    1. Initial program 16.8

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

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

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

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

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

    if 563.9094021205955 < b

    1. Initial program 36.3

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

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

      \[\leadsto \frac{\color{blue}{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied associate-/r*16.4

      \[\leadsto \color{blue}{\frac{\frac{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}{3}}{a}}\]
    6. Simplified16.4

      \[\leadsto \frac{\color{blue}{\left(c \cdot \frac{-1}{2}\right) \cdot \frac{a}{b}}}{a}\]
    7. Taylor expanded around 0 16.3

      \[\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 563.9094021205955:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right)}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2019163 
(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)))