Average Error: 28.1 → 16.4
Time: 21.5s
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 1315.7127116390275:\\ \;\;\;\;\frac{\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 + \sqrt{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 b}}{a}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot \frac{c}{b}}{2}\\ \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 1315.7127116390275:\\
\;\;\;\;\frac{\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 + \sqrt{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 b}}{a}}{2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1192073 = b;
        double r1192074 = -r1192073;
        double r1192075 = r1192073 * r1192073;
        double r1192076 = 4.0;
        double r1192077 = a;
        double r1192078 = r1192076 * r1192077;
        double r1192079 = c;
        double r1192080 = r1192078 * r1192079;
        double r1192081 = r1192075 - r1192080;
        double r1192082 = sqrt(r1192081);
        double r1192083 = r1192074 + r1192082;
        double r1192084 = 2.0;
        double r1192085 = r1192084 * r1192077;
        double r1192086 = r1192083 / r1192085;
        return r1192086;
}

double f(double a, double b, double c) {
        double r1192087 = b;
        double r1192088 = 1315.7127116390275;
        bool r1192089 = r1192087 <= r1192088;
        double r1192090 = r1192087 * r1192087;
        double r1192091 = c;
        double r1192092 = a;
        double r1192093 = r1192091 * r1192092;
        double r1192094 = -4.0;
        double r1192095 = r1192093 * r1192094;
        double r1192096 = r1192090 + r1192095;
        double r1192097 = sqrt(r1192096);
        double r1192098 = r1192096 * r1192097;
        double r1192099 = r1192090 * r1192087;
        double r1192100 = r1192098 - r1192099;
        double r1192101 = r1192087 + r1192097;
        double r1192102 = r1192101 * r1192097;
        double r1192103 = r1192102 + r1192090;
        double r1192104 = r1192100 / r1192103;
        double r1192105 = r1192104 / r1192092;
        double r1192106 = 2.0;
        double r1192107 = r1192105 / r1192106;
        double r1192108 = -2.0;
        double r1192109 = r1192091 / r1192087;
        double r1192110 = r1192108 * r1192109;
        double r1192111 = r1192110 / r1192106;
        double r1192112 = r1192089 ? r1192107 : r1192111;
        return r1192112;
}

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

    1. Initial program 16.9

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

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

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

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

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

    if 1315.7127116390275 < b

    1. Initial program 36.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 1315.7127116390275:\\ \;\;\;\;\frac{\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 + \sqrt{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 b}}{a}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot \frac{c}{b}}{2}\\ \end{array}\]

Reproduce

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