Average Error: 43.4 → 11.3
Time: 14.8s
Precision: 64
\[1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt a \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt b \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt c \lt 9007199254740992\]
\[\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 0.001614548699194859283576053421427332068561:\\ \;\;\;\;\frac{\frac{\left({b}^{2} - 4 \cdot \left(a \cdot c\right)\right) - b \cdot b}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + b}}{2 \cdot 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 0.001614548699194859283576053421427332068561:\\
\;\;\;\;\frac{\frac{\left({b}^{2} - 4 \cdot \left(a \cdot c\right)\right) - b \cdot b}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + b}}{2 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r28168 = b;
        double r28169 = -r28168;
        double r28170 = r28168 * r28168;
        double r28171 = 4.0;
        double r28172 = a;
        double r28173 = r28171 * r28172;
        double r28174 = c;
        double r28175 = r28173 * r28174;
        double r28176 = r28170 - r28175;
        double r28177 = sqrt(r28176);
        double r28178 = r28169 + r28177;
        double r28179 = 2.0;
        double r28180 = r28179 * r28172;
        double r28181 = r28178 / r28180;
        return r28181;
}

double f(double a, double b, double c) {
        double r28182 = b;
        double r28183 = 0.0016145486991948593;
        bool r28184 = r28182 <= r28183;
        double r28185 = 2.0;
        double r28186 = pow(r28182, r28185);
        double r28187 = 4.0;
        double r28188 = a;
        double r28189 = c;
        double r28190 = r28188 * r28189;
        double r28191 = r28187 * r28190;
        double r28192 = r28186 - r28191;
        double r28193 = r28182 * r28182;
        double r28194 = r28192 - r28193;
        double r28195 = r28187 * r28188;
        double r28196 = r28195 * r28189;
        double r28197 = r28193 - r28196;
        double r28198 = sqrt(r28197);
        double r28199 = r28198 + r28182;
        double r28200 = r28194 / r28199;
        double r28201 = 2.0;
        double r28202 = r28201 * r28188;
        double r28203 = r28200 / r28202;
        double r28204 = -1.0;
        double r28205 = r28189 / r28182;
        double r28206 = r28204 * r28205;
        double r28207 = r28184 ? r28203 : r28206;
        return r28207;
}

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

    1. Initial program 20.0

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

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

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

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

    if 0.0016145486991948593 < b

    1. Initial program 45.8

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

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

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

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

Reproduce

herbie shell --seed 2019306 
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :precision binary64
  :pre (and (< 1.11022e-16 a 9.0072e15) (< 1.11022e-16 b 9.0072e15) (< 1.11022e-16 c 9.0072e15))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))