Average Error: 44.3 → 10.9
Time: 20.9s
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 3.826212081602258 \cdot 10^{-05}:\\ \;\;\;\;\frac{\left(\sqrt[3]{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b} \cdot \sqrt[3]{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b}\right) \cdot \frac{\sqrt[3]{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - 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 3.826212081602258 \cdot 10^{-05}:\\
\;\;\;\;\frac{\left(\sqrt[3]{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b} \cdot \sqrt[3]{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b}\right) \cdot \frac{\sqrt[3]{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b}}{a}}{2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1363552 = b;
        double r1363553 = -r1363552;
        double r1363554 = r1363552 * r1363552;
        double r1363555 = 4.0;
        double r1363556 = a;
        double r1363557 = r1363555 * r1363556;
        double r1363558 = c;
        double r1363559 = r1363557 * r1363558;
        double r1363560 = r1363554 - r1363559;
        double r1363561 = sqrt(r1363560);
        double r1363562 = r1363553 + r1363561;
        double r1363563 = 2.0;
        double r1363564 = r1363563 * r1363556;
        double r1363565 = r1363562 / r1363564;
        return r1363565;
}

double f(double a, double b, double c) {
        double r1363566 = b;
        double r1363567 = 3.826212081602258e-05;
        bool r1363568 = r1363566 <= r1363567;
        double r1363569 = r1363566 * r1363566;
        double r1363570 = 4.0;
        double r1363571 = c;
        double r1363572 = a;
        double r1363573 = r1363571 * r1363572;
        double r1363574 = r1363570 * r1363573;
        double r1363575 = r1363569 - r1363574;
        double r1363576 = sqrt(r1363575);
        double r1363577 = r1363576 - r1363566;
        double r1363578 = cbrt(r1363577);
        double r1363579 = r1363578 * r1363578;
        double r1363580 = r1363578 / r1363572;
        double r1363581 = r1363579 * r1363580;
        double r1363582 = 2.0;
        double r1363583 = r1363581 / r1363582;
        double r1363584 = -2.0;
        double r1363585 = r1363571 / r1363566;
        double r1363586 = r1363584 * r1363585;
        double r1363587 = r1363586 / r1363582;
        double r1363588 = r1363568 ? r1363583 : r1363587;
        return r1363588;
}

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

    1. Initial program 18.4

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

      \[\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 *-un-lft-identity18.4

      \[\leadsto \frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}{\color{blue}{1 \cdot a}}}{2}\]
    5. Applied add-cube-cbrt18.4

      \[\leadsto \frac{\frac{\color{blue}{\left(\sqrt[3]{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}}}{1 \cdot a}}{2}\]
    6. Applied times-frac18.4

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

    if 3.826212081602258e-05 < b

    1. Initial program 45.9

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

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

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

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

Reproduce

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