Average Error: 28.4 → 16.6
Time: 50.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 3546.1484051701364:\\ \;\;\;\;\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)} - \left(b \cdot b\right) \cdot b}{\left(2 \cdot a\right) \cdot \left(\left(b \cdot b + b \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right) + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right)}\\ \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 3546.1484051701364:\\
\;\;\;\;\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)} - \left(b \cdot b\right) \cdot b}{\left(2 \cdot a\right) \cdot \left(\left(b \cdot b + b \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right) + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right)}\\

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

\end{array}
double f(double a, double b, double c) {
        double r5829334 = b;
        double r5829335 = -r5829334;
        double r5829336 = r5829334 * r5829334;
        double r5829337 = 4.0;
        double r5829338 = a;
        double r5829339 = r5829337 * r5829338;
        double r5829340 = c;
        double r5829341 = r5829339 * r5829340;
        double r5829342 = r5829336 - r5829341;
        double r5829343 = sqrt(r5829342);
        double r5829344 = r5829335 + r5829343;
        double r5829345 = 2.0;
        double r5829346 = r5829345 * r5829338;
        double r5829347 = r5829344 / r5829346;
        return r5829347;
}

double f(double a, double b, double c) {
        double r5829348 = b;
        double r5829349 = 3546.1484051701364;
        bool r5829350 = r5829348 <= r5829349;
        double r5829351 = r5829348 * r5829348;
        double r5829352 = 4.0;
        double r5829353 = c;
        double r5829354 = a;
        double r5829355 = r5829353 * r5829354;
        double r5829356 = r5829352 * r5829355;
        double r5829357 = r5829351 - r5829356;
        double r5829358 = sqrt(r5829357);
        double r5829359 = r5829357 * r5829358;
        double r5829360 = r5829351 * r5829348;
        double r5829361 = r5829359 - r5829360;
        double r5829362 = 2.0;
        double r5829363 = r5829362 * r5829354;
        double r5829364 = r5829348 * r5829358;
        double r5829365 = r5829351 + r5829364;
        double r5829366 = r5829358 * r5829358;
        double r5829367 = r5829365 + r5829366;
        double r5829368 = r5829363 * r5829367;
        double r5829369 = r5829361 / r5829368;
        double r5829370 = r5829353 / r5829348;
        double r5829371 = -r5829370;
        double r5829372 = r5829350 ? r5829369 : r5829371;
        return r5829372;
}

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

    1. Initial program 18.5

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

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

      \[\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. Applied associate-/l/18.6

      \[\leadsto \color{blue}{\frac{{\left(\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}\right)}^{3} - {b}^{3}}{\left(2 \cdot a\right) \cdot \left(\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)\right)}}\]
    6. Simplified17.8

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

    if 3546.1484051701364 < b

    1. Initial program 37.3

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

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

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

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

Reproduce

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