Average Error: 43.8 → 11.3
Time: 21.1s
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\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 4.197456508925139 \cdot 10^{-05}:\\ \;\;\;\;\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 4.197456508925139 \cdot 10^{-05}:\\
\;\;\;\;\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 r1246477 = b;
        double r1246478 = -r1246477;
        double r1246479 = r1246477 * r1246477;
        double r1246480 = 4.0;
        double r1246481 = a;
        double r1246482 = r1246480 * r1246481;
        double r1246483 = c;
        double r1246484 = r1246482 * r1246483;
        double r1246485 = r1246479 - r1246484;
        double r1246486 = sqrt(r1246485);
        double r1246487 = r1246478 + r1246486;
        double r1246488 = 2.0;
        double r1246489 = r1246488 * r1246481;
        double r1246490 = r1246487 / r1246489;
        return r1246490;
}

double f(double a, double b, double c) {
        double r1246491 = b;
        double r1246492 = 4.197456508925139e-05;
        bool r1246493 = r1246491 <= r1246492;
        double r1246494 = r1246491 * r1246491;
        double r1246495 = c;
        double r1246496 = a;
        double r1246497 = r1246495 * r1246496;
        double r1246498 = -4.0;
        double r1246499 = r1246497 * r1246498;
        double r1246500 = r1246494 + r1246499;
        double r1246501 = sqrt(r1246500);
        double r1246502 = r1246500 * r1246501;
        double r1246503 = r1246494 * r1246491;
        double r1246504 = r1246502 - r1246503;
        double r1246505 = r1246491 + r1246501;
        double r1246506 = r1246505 * r1246501;
        double r1246507 = r1246506 + r1246494;
        double r1246508 = r1246504 / r1246507;
        double r1246509 = r1246508 / r1246496;
        double r1246510 = 2.0;
        double r1246511 = r1246509 / r1246510;
        double r1246512 = -2.0;
        double r1246513 = r1246495 / r1246491;
        double r1246514 = r1246512 * r1246513;
        double r1246515 = r1246514 / r1246510;
        double r1246516 = r1246493 ? r1246511 : r1246515;
        return r1246516;
}

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 < 4.197456508925139e-05

    1. Initial program 18.7

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

      \[\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--18.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)}}}{a}}{2}\]
    5. Simplified18.1

      \[\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. Simplified18.1

      \[\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 4.197456508925139e-05 < b

    1. Initial program 45.3

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 4.197456508925139 \cdot 10^{-05}:\\ \;\;\;\;\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 2019149 
(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 a) c)))) (* 2 a)))