Average Error: 28.8 → 16.2
Time: 16.4s
Precision: 64
\[1.0536712127723509 \cdot 10^{-08} \lt a \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt b \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt c \lt 94906265.62425156\]
\[\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 1083.7283358723973:\\ \;\;\;\;\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 1083.7283358723973:\\
\;\;\;\;\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 r974621 = b;
        double r974622 = -r974621;
        double r974623 = r974621 * r974621;
        double r974624 = 4.0;
        double r974625 = a;
        double r974626 = r974624 * r974625;
        double r974627 = c;
        double r974628 = r974626 * r974627;
        double r974629 = r974623 - r974628;
        double r974630 = sqrt(r974629);
        double r974631 = r974622 + r974630;
        double r974632 = 2.0;
        double r974633 = r974632 * r974625;
        double r974634 = r974631 / r974633;
        return r974634;
}

double f(double a, double b, double c) {
        double r974635 = b;
        double r974636 = 1083.7283358723973;
        bool r974637 = r974635 <= r974636;
        double r974638 = r974635 * r974635;
        double r974639 = c;
        double r974640 = a;
        double r974641 = r974639 * r974640;
        double r974642 = -4.0;
        double r974643 = r974641 * r974642;
        double r974644 = r974638 + r974643;
        double r974645 = sqrt(r974644);
        double r974646 = r974644 * r974645;
        double r974647 = r974638 * r974635;
        double r974648 = r974646 - r974647;
        double r974649 = r974635 + r974645;
        double r974650 = r974649 * r974645;
        double r974651 = r974650 + r974638;
        double r974652 = r974648 / r974651;
        double r974653 = r974652 / r974640;
        double r974654 = 2.0;
        double r974655 = r974653 / r974654;
        double r974656 = -2.0;
        double r974657 = r974639 / r974635;
        double r974658 = r974656 * r974657;
        double r974659 = r974658 / r974654;
        double r974660 = r974637 ? r974655 : r974659;
        return r974660;
}

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

    1. Initial program 17.4

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

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

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

      \[\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 1083.7283358723973 < b

    1. Initial program 36.7

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

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

      \[\leadsto \frac{\frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a}}{2}\]
    4. Taylor expanded around 0 15.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 1083.7283358723973:\\ \;\;\;\;\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 2019151 
(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 a) c)))) (* 2 a)))