Average Error: 43.0 → 11.7
Time: 18.3s
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 1.143841598112384838194601800742677966127 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b - 4 \cdot \left(c \cdot a\right)\right) \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - 4 \cdot \left(c \cdot a\right)\right) + b \cdot \left(b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\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 1.143841598112384838194601800742677966127 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b - 4 \cdot \left(c \cdot a\right)\right) \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - 4 \cdot \left(c \cdot a\right)\right) + b \cdot \left(b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right)}}{2}}{a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1629439 = b;
        double r1629440 = -r1629439;
        double r1629441 = r1629439 * r1629439;
        double r1629442 = 4.0;
        double r1629443 = a;
        double r1629444 = r1629442 * r1629443;
        double r1629445 = c;
        double r1629446 = r1629444 * r1629445;
        double r1629447 = r1629441 - r1629446;
        double r1629448 = sqrt(r1629447);
        double r1629449 = r1629440 + r1629448;
        double r1629450 = 2.0;
        double r1629451 = r1629450 * r1629443;
        double r1629452 = r1629449 / r1629451;
        return r1629452;
}

double f(double a, double b, double c) {
        double r1629453 = b;
        double r1629454 = 1.1438415981123848e-06;
        bool r1629455 = r1629453 <= r1629454;
        double r1629456 = r1629453 * r1629453;
        double r1629457 = 4.0;
        double r1629458 = c;
        double r1629459 = a;
        double r1629460 = r1629458 * r1629459;
        double r1629461 = r1629457 * r1629460;
        double r1629462 = r1629456 - r1629461;
        double r1629463 = sqrt(r1629462);
        double r1629464 = r1629462 * r1629463;
        double r1629465 = r1629456 * r1629453;
        double r1629466 = r1629464 - r1629465;
        double r1629467 = r1629453 + r1629463;
        double r1629468 = r1629453 * r1629467;
        double r1629469 = r1629462 + r1629468;
        double r1629470 = r1629466 / r1629469;
        double r1629471 = 2.0;
        double r1629472 = r1629470 / r1629471;
        double r1629473 = r1629472 / r1629459;
        double r1629474 = -1.0;
        double r1629475 = r1629458 / r1629453;
        double r1629476 = r1629474 * r1629475;
        double r1629477 = r1629455 ? r1629473 : r1629476;
        return r1629477;
}

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 < 1.1438415981123848e-06

    1. Initial program 14.4

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

      \[\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--14.4

      \[\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. Simplified13.8

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

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

    if 1.1438415981123848e-06 < b

    1. Initial program 44.2

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

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

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

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

Reproduce

herbie shell --seed 2019171 
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))