Average Error: 28.2 → 16.3
Time: 25.2s
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 1984.600261148631:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} + b \cdot b\right)}}{a}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-2 \cdot \left(a \cdot c\right)}{a \cdot 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 1984.600261148631:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} + b \cdot b\right)}}{a}}{2}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{-2 \cdot \left(a \cdot c\right)}{a \cdot b}}{2}\\

\end{array}
double f(double a, double b, double c) {
        double r1835110 = b;
        double r1835111 = -r1835110;
        double r1835112 = r1835110 * r1835110;
        double r1835113 = 4.0;
        double r1835114 = a;
        double r1835115 = r1835113 * r1835114;
        double r1835116 = c;
        double r1835117 = r1835115 * r1835116;
        double r1835118 = r1835112 - r1835117;
        double r1835119 = sqrt(r1835118);
        double r1835120 = r1835111 + r1835119;
        double r1835121 = 2.0;
        double r1835122 = r1835121 * r1835114;
        double r1835123 = r1835120 / r1835122;
        return r1835123;
}

double f(double a, double b, double c) {
        double r1835124 = b;
        double r1835125 = 1984.600261148631;
        bool r1835126 = r1835124 <= r1835125;
        double r1835127 = r1835124 * r1835124;
        double r1835128 = a;
        double r1835129 = -4.0;
        double r1835130 = c;
        double r1835131 = r1835129 * r1835130;
        double r1835132 = r1835128 * r1835131;
        double r1835133 = r1835127 + r1835132;
        double r1835134 = sqrt(r1835133);
        double r1835135 = r1835133 * r1835134;
        double r1835136 = r1835127 * r1835124;
        double r1835137 = r1835135 - r1835136;
        double r1835138 = r1835124 * r1835134;
        double r1835139 = r1835138 + r1835127;
        double r1835140 = r1835133 + r1835139;
        double r1835141 = r1835137 / r1835140;
        double r1835142 = r1835141 / r1835128;
        double r1835143 = 2.0;
        double r1835144 = r1835142 / r1835143;
        double r1835145 = -2.0;
        double r1835146 = r1835128 * r1835130;
        double r1835147 = r1835145 * r1835146;
        double r1835148 = r1835128 * r1835124;
        double r1835149 = r1835147 / r1835148;
        double r1835150 = r1835149 / r1835143;
        double r1835151 = r1835126 ? r1835144 : r1835150;
        return r1835151;
}

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

    1. Initial program 17.2

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

      \[\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.2

      \[\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.6

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

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

    if 1984.600261148631 < b

    1. Initial program 36.7

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

      \[\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.0

      \[\leadsto \frac{\frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a}}{2}\]
    4. Using strategy rm
    5. Applied associate-*r/16.0

      \[\leadsto \frac{\frac{\color{blue}{\frac{-2 \cdot \left(a \cdot c\right)}{b}}}{a}}{2}\]
    6. Applied associate-/l/16.0

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

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

Reproduce

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