Average Error: 52.5 → 6.2
Time: 7.8s
Precision: 64
\[4.93038 \cdot 10^{-32} \lt a \lt 2.02824 \cdot 10^{31} \land 4.93038 \cdot 10^{-32} \lt b \lt 2.02824 \cdot 10^{31} \land 4.93038 \cdot 10^{-32} \lt c \lt 2.02824 \cdot 10^{31}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[-1 \cdot \frac{c}{b}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
-1 \cdot \frac{c}{b}
double f(double a, double b, double c) {
        double r20839 = b;
        double r20840 = -r20839;
        double r20841 = r20839 * r20839;
        double r20842 = 4.0;
        double r20843 = a;
        double r20844 = r20842 * r20843;
        double r20845 = c;
        double r20846 = r20844 * r20845;
        double r20847 = r20841 - r20846;
        double r20848 = sqrt(r20847);
        double r20849 = r20840 + r20848;
        double r20850 = 2.0;
        double r20851 = r20850 * r20843;
        double r20852 = r20849 / r20851;
        return r20852;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r20853 = -1.0;
        double r20854 = c;
        double r20855 = b;
        double r20856 = r20854 / r20855;
        double r20857 = r20853 * r20856;
        return r20857;
}

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. Initial program 52.5

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

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

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}}\]
  4. Final simplification6.2

    \[\leadsto -1 \cdot \frac{c}{b}\]

Reproduce

herbie shell --seed 2020042 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :precision binary64
  :pre (and (< 4.9303800000000003e-32 a 2.02824e+31) (< 4.9303800000000003e-32 b 2.02824e+31) (< 4.9303800000000003e-32 c 2.02824e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))