Average Error: 52.9 → 5.9
Time: 2.0m
Precision: 64
\[4.930380657631324 \cdot 10^{-32} \lt a \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt b \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt c \lt 2.028240960365167 \cdot 10^{+31}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[-\frac{c}{b}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
-\frac{c}{b}
double f(double a, double b, double c) {
        double r10099986 = b;
        double r10099987 = -r10099986;
        double r10099988 = r10099986 * r10099986;
        double r10099989 = 4.0;
        double r10099990 = a;
        double r10099991 = r10099989 * r10099990;
        double r10099992 = c;
        double r10099993 = r10099991 * r10099992;
        double r10099994 = r10099988 - r10099993;
        double r10099995 = sqrt(r10099994);
        double r10099996 = r10099987 + r10099995;
        double r10099997 = 2.0;
        double r10099998 = r10099997 * r10099990;
        double r10099999 = r10099996 / r10099998;
        return r10099999;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r10100000 = c;
        double r10100001 = b;
        double r10100002 = r10100000 / r10100001;
        double r10100003 = -r10100002;
        return r10100003;
}

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.9

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

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

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}}\]
  4. Simplified5.9

    \[\leadsto \color{blue}{-\frac{c}{b}}\]
  5. Final simplification5.9

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

Reproduce

herbie shell --seed 2019125 
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :pre (and (< 4.930380657631324e-32 a 2.028240960365167e+31) (< 4.930380657631324e-32 b 2.028240960365167e+31) (< 4.930380657631324e-32 c 2.028240960365167e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))