Average Error: 28.3 → 16.6
Time: 14.3s
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(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 1228.7650470545104:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - \left(c \cdot a\right) \cdot 4\right) \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - \left(c \cdot a\right) \cdot 4\right) + \left(b \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b \cdot b\right)}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-\frac{c}{b}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le 1228.7650470545104:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - \left(c \cdot a\right) \cdot 4\right) \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - \left(c \cdot a\right) \cdot 4\right) + \left(b \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b \cdot b\right)}}{2 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1032200 = b;
        double r1032201 = -r1032200;
        double r1032202 = r1032200 * r1032200;
        double r1032203 = 4.0;
        double r1032204 = a;
        double r1032205 = r1032203 * r1032204;
        double r1032206 = c;
        double r1032207 = r1032205 * r1032206;
        double r1032208 = r1032202 - r1032207;
        double r1032209 = sqrt(r1032208);
        double r1032210 = r1032201 + r1032209;
        double r1032211 = 2.0;
        double r1032212 = r1032211 * r1032204;
        double r1032213 = r1032210 / r1032212;
        return r1032213;
}

double f(double a, double b, double c) {
        double r1032214 = b;
        double r1032215 = 1228.7650470545104;
        bool r1032216 = r1032214 <= r1032215;
        double r1032217 = r1032214 * r1032214;
        double r1032218 = c;
        double r1032219 = a;
        double r1032220 = r1032218 * r1032219;
        double r1032221 = 4.0;
        double r1032222 = r1032220 * r1032221;
        double r1032223 = r1032217 - r1032222;
        double r1032224 = sqrt(r1032223);
        double r1032225 = r1032223 * r1032224;
        double r1032226 = r1032217 * r1032214;
        double r1032227 = r1032225 - r1032226;
        double r1032228 = r1032214 * r1032224;
        double r1032229 = r1032228 + r1032217;
        double r1032230 = r1032223 + r1032229;
        double r1032231 = r1032227 / r1032230;
        double r1032232 = 2.0;
        double r1032233 = r1032232 * r1032219;
        double r1032234 = r1032231 / r1032233;
        double r1032235 = r1032218 / r1032214;
        double r1032236 = -r1032235;
        double r1032237 = r1032216 ? r1032234 : r1032236;
        return r1032237;
}

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

    1. Initial program 17.4

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\left(b \cdot b - 4 \cdot \left(c \cdot a\right)\right) \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b \cdot \left(b \cdot b\right)}}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + \left(b \cdot b + \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} \cdot b\right)}}{2 \cdot a}\]
    6. Simplified16.7

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

    if 1228.7650470545104 < b

    1. Initial program 35.8

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

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

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

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

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

Reproduce

herbie shell --seed 2019133 
(FPCore (a b c)
  :name "Quadratic roots, 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) (* (* 4 a) c)))) (* 2 a)))