Average Error: 28.5 → 16.4
Time: 13.9s
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 2435.2513491695368:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b + \left(-4 \cdot a\right) \cdot c\right) \cdot \sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + \left(-4 \cdot a\right) \cdot c\right) + \left(b \cdot \sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c} + b \cdot b\right)}}{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 2435.2513491695368:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b + \left(-4 \cdot a\right) \cdot c\right) \cdot \sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + \left(-4 \cdot a\right) \cdot c\right) + \left(b \cdot \sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c} + b \cdot b\right)}}{a}}{2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1465629 = b;
        double r1465630 = -r1465629;
        double r1465631 = r1465629 * r1465629;
        double r1465632 = 4.0;
        double r1465633 = a;
        double r1465634 = r1465632 * r1465633;
        double r1465635 = c;
        double r1465636 = r1465634 * r1465635;
        double r1465637 = r1465631 - r1465636;
        double r1465638 = sqrt(r1465637);
        double r1465639 = r1465630 + r1465638;
        double r1465640 = 2.0;
        double r1465641 = r1465640 * r1465633;
        double r1465642 = r1465639 / r1465641;
        return r1465642;
}

double f(double a, double b, double c) {
        double r1465643 = b;
        double r1465644 = 2435.2513491695368;
        bool r1465645 = r1465643 <= r1465644;
        double r1465646 = r1465643 * r1465643;
        double r1465647 = -4.0;
        double r1465648 = a;
        double r1465649 = r1465647 * r1465648;
        double r1465650 = c;
        double r1465651 = r1465649 * r1465650;
        double r1465652 = r1465646 + r1465651;
        double r1465653 = sqrt(r1465652);
        double r1465654 = r1465652 * r1465653;
        double r1465655 = r1465646 * r1465643;
        double r1465656 = r1465654 - r1465655;
        double r1465657 = r1465643 * r1465653;
        double r1465658 = r1465657 + r1465646;
        double r1465659 = r1465652 + r1465658;
        double r1465660 = r1465656 / r1465659;
        double r1465661 = r1465660 / r1465648;
        double r1465662 = 2.0;
        double r1465663 = r1465661 / r1465662;
        double r1465664 = -2.0;
        double r1465665 = r1465650 / r1465643;
        double r1465666 = r1465664 * r1465665;
        double r1465667 = r1465666 / r1465662;
        double r1465668 = r1465645 ? r1465663 : r1465667;
        return r1465668;
}

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

    1. Initial program 17.8

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

      \[\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.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. Simplified17.2

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

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

    if 2435.2513491695368 < b

    1. Initial program 37.0

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

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

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

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

Reproduce

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