Average Error: 28.7 → 16.8
Time: 17.2s
Precision: 64
\[1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt a \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt b \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt c \lt 94906265.62425155937671661376953125\]
\[\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 53.72772989939689125549193704500794410706:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) - b \cdot b}{b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 250.8081548127311179996468126773834228516:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \mathbf{elif}\;b \le 2125.07914601017046152264811098575592041:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) - b \cdot b}{b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \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 53.72772989939689125549193704500794410706:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) - b \cdot b}{b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{3 \cdot a}\\

\mathbf{elif}\;b \le 250.8081548127311179996468126773834228516:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\

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

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

\end{array}
double f(double a, double b, double c) {
        double r3674249 = b;
        double r3674250 = -r3674249;
        double r3674251 = r3674249 * r3674249;
        double r3674252 = 3.0;
        double r3674253 = a;
        double r3674254 = r3674252 * r3674253;
        double r3674255 = c;
        double r3674256 = r3674254 * r3674255;
        double r3674257 = r3674251 - r3674256;
        double r3674258 = sqrt(r3674257);
        double r3674259 = r3674250 + r3674258;
        double r3674260 = r3674259 / r3674254;
        return r3674260;
}

double f(double a, double b, double c) {
        double r3674261 = b;
        double r3674262 = 53.72772989939689;
        bool r3674263 = r3674261 <= r3674262;
        double r3674264 = r3674261 * r3674261;
        double r3674265 = c;
        double r3674266 = 3.0;
        double r3674267 = a;
        double r3674268 = r3674266 * r3674267;
        double r3674269 = r3674265 * r3674268;
        double r3674270 = r3674264 - r3674269;
        double r3674271 = r3674270 - r3674264;
        double r3674272 = sqrt(r3674270);
        double r3674273 = r3674261 + r3674272;
        double r3674274 = r3674271 / r3674273;
        double r3674275 = r3674274 / r3674268;
        double r3674276 = 250.80815481273112;
        bool r3674277 = r3674261 <= r3674276;
        double r3674278 = r3674265 / r3674261;
        double r3674279 = -0.5;
        double r3674280 = r3674278 * r3674279;
        double r3674281 = 2125.0791460101705;
        bool r3674282 = r3674261 <= r3674281;
        double r3674283 = r3674282 ? r3674275 : r3674280;
        double r3674284 = r3674277 ? r3674280 : r3674283;
        double r3674285 = r3674263 ? r3674275 : r3674284;
        return r3674285;
}

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 < 53.72772989939689 or 250.80815481273112 < b < 2125.0791460101705

    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 flip--17.3

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

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

    if 53.72772989939689 < b < 250.80815481273112 or 2125.0791460101705 < b

    1. Initial program 35.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 53.72772989939689125549193704500794410706:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) - b \cdot b}{b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 250.8081548127311179996468126773834228516:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \mathbf{elif}\;b \le 2125.07914601017046152264811098575592041:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) - b \cdot b}{b + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 
(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.0 a) c)))) (* 3.0 a)))