Average Error: 28.4 → 16.6
Time: 21.2s
Precision: 64
\[1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt a \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt b \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt c \lt 94906265.62425155937671661376953125\]
\[\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 245.5646346995640669774729758501052856445:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} + b \cdot b\right)}}{2}}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \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 245.5646346995640669774729758501052856445:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} + b \cdot b\right)}}{2}}{a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1738113 = b;
        double r1738114 = -r1738113;
        double r1738115 = r1738113 * r1738113;
        double r1738116 = 4.0;
        double r1738117 = a;
        double r1738118 = r1738116 * r1738117;
        double r1738119 = c;
        double r1738120 = r1738118 * r1738119;
        double r1738121 = r1738115 - r1738120;
        double r1738122 = sqrt(r1738121);
        double r1738123 = r1738114 + r1738122;
        double r1738124 = 2.0;
        double r1738125 = r1738124 * r1738117;
        double r1738126 = r1738123 / r1738125;
        return r1738126;
}

double f(double a, double b, double c) {
        double r1738127 = b;
        double r1738128 = 245.56463469956407;
        bool r1738129 = r1738127 <= r1738128;
        double r1738130 = r1738127 * r1738127;
        double r1738131 = c;
        double r1738132 = 4.0;
        double r1738133 = a;
        double r1738134 = r1738132 * r1738133;
        double r1738135 = r1738131 * r1738134;
        double r1738136 = r1738130 - r1738135;
        double r1738137 = sqrt(r1738136);
        double r1738138 = r1738136 * r1738137;
        double r1738139 = r1738130 * r1738127;
        double r1738140 = r1738138 - r1738139;
        double r1738141 = r1738127 * r1738137;
        double r1738142 = r1738141 + r1738130;
        double r1738143 = r1738136 + r1738142;
        double r1738144 = r1738140 / r1738143;
        double r1738145 = 2.0;
        double r1738146 = r1738144 / r1738145;
        double r1738147 = r1738146 / r1738133;
        double r1738148 = -1.0;
        double r1738149 = r1738131 / r1738127;
        double r1738150 = r1738148 * r1738149;
        double r1738151 = r1738129 ? r1738147 : r1738150;
        return r1738151;
}

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

    1. Initial program 15.8

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Simplified15.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--15.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. Simplified15.2

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

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

    if 245.56463469956407 < b

    1. Initial program 34.8

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

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

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

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

Reproduce

herbie shell --seed 2019192 
(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.0 a) c)))) (* 2.0 a)))