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

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

\end{array}
double f(double a, double b, double c) {
        double r2001481 = b;
        double r2001482 = -r2001481;
        double r2001483 = r2001481 * r2001481;
        double r2001484 = 4.0;
        double r2001485 = a;
        double r2001486 = r2001484 * r2001485;
        double r2001487 = c;
        double r2001488 = r2001486 * r2001487;
        double r2001489 = r2001483 - r2001488;
        double r2001490 = sqrt(r2001489);
        double r2001491 = r2001482 + r2001490;
        double r2001492 = 2.0;
        double r2001493 = r2001492 * r2001485;
        double r2001494 = r2001491 / r2001493;
        return r2001494;
}

double f(double a, double b, double c) {
        double r2001495 = b;
        double r2001496 = 781.9086092205042;
        bool r2001497 = r2001495 <= r2001496;
        double r2001498 = r2001495 * r2001495;
        double r2001499 = c;
        double r2001500 = -4.0;
        double r2001501 = r2001499 * r2001500;
        double r2001502 = a;
        double r2001503 = r2001501 * r2001502;
        double r2001504 = r2001498 + r2001503;
        double r2001505 = sqrt(r2001504);
        double r2001506 = r2001504 * r2001505;
        double r2001507 = r2001498 * r2001495;
        double r2001508 = r2001506 - r2001507;
        double r2001509 = r2001495 * r2001505;
        double r2001510 = r2001509 + r2001498;
        double r2001511 = r2001504 + r2001510;
        double r2001512 = r2001508 / r2001511;
        double r2001513 = 2.0;
        double r2001514 = r2001512 / r2001513;
        double r2001515 = r2001514 / r2001502;
        double r2001516 = r2001499 / r2001495;
        double r2001517 = -r2001516;
        double r2001518 = r2001497 ? r2001515 : r2001517;
        return r2001518;
}

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

    1. Initial program 16.8

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

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

      \[\leadsto \frac{\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}}{a}\]
    5. Simplified16.2

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

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

    if 781.9086092205042 < b

    1. Initial program 35.6

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

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

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

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

Reproduce

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